:root {
  color-scheme: dark;
  --background: #07100f;
  --foreground: #eefbf8;
  --card: rgba(9, 21, 24, 0.76);
  --card-foreground: #eefbf8;
  --muted: rgba(255, 255, 255, 0.08);
  --muted-foreground: #9db5b4;
  --primary: #21f3d3;
  --primary-foreground: #ffffff;
  --secondary: rgba(255, 255, 255, 0.09);
  --secondary-foreground: #e9fffb;
  --accent: rgba(157, 92, 255, 0.16);
  --accent-foreground: #e8d9ff;
  --destructive: #ff6a5f;
  --destructive-foreground: #ffffff;
  --success: #21f3d3;
  --success-soft: rgba(33, 243, 211, 0.15);
  --warning: #f6c66f;
  --warning-soft: rgba(246, 198, 111, 0.16);
  --destructive-soft: rgba(255, 106, 95, 0.16);
  --border: rgba(154, 255, 237, 0.18);
  --input: rgba(154, 255, 237, 0.2);
  --ring: rgba(33, 243, 211, 0.24);
  --radius: 8px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--background);
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(rgba(33, 243, 211, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(33, 243, 211, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 88% 8%, rgba(33, 243, 211, 0.22), transparent 24rem),
    radial-gradient(circle at 18% 88%, rgba(157, 92, 255, 0.18), transparent 24rem),
    radial-gradient(circle at 70% 75%, rgba(246, 198, 111, 0.08), transparent 18rem),
    var(--background);
  background-size: 36px 36px, 36px 36px, auto, auto, auto, auto;
  color: var(--foreground);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

a {
  color: inherit;
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: rgba(2, 10, 12, 0.56);
  color: var(--foreground);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

textarea {
  min-height: 118px;
  resize: vertical;
  line-height: 1.55;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}

input[type="checkbox"] {
  width: 16px;
  min-width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  border-right: 1px solid var(--border);
  background: rgba(4, 13, 16, 0.78);
  backdrop-filter: blur(16px);
}

.brand {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 8px;
  border-radius: var(--radius);
  text-decoration: none;
}

.brand:hover {
  background: rgba(33, 243, 211, 0.1);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #21f3d3, #9d5cff);
  color: #06100f;
  box-shadow: 0 0 24px rgba(33, 243, 211, 0.34);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

.brand-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.brand-copy strong {
  font-size: 16px;
  line-height: 1.2;
}

.brand-copy small {
  color: var(--muted-foreground);
  font-size: 12px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: #cce7e4;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.nav a span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted-foreground);
  font-size: 12px;
}

.nav a:hover,
.nav a.active {
  background: linear-gradient(135deg, rgba(33, 243, 211, 0.18), rgba(157, 92, 255, 0.2));
  color: #f8fffd;
  box-shadow: inset 0 0 0 1px rgba(33, 243, 211, 0.26), 0 0 22px rgba(33, 243, 211, 0.12);
}

.nav a:hover span,
.nav a.active span {
  background: rgba(255, 255, 255, 0.16);
  color: var(--primary-foreground);
}

.sidebar-card {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(8, 22, 25, 0.64);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.connector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #d7f4ef;
  font-size: 13px;
}

.connector strong {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(33, 243, 211, 0.13);
  color: var(--secondary-foreground);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.main-shell {
  min-width: 0;
  padding: 24px;
}

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

.page-heading {
  display: grid;
  gap: 4px;
}

.eyebrow,
.section-label {
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.page-heading h1 {
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.12;
  letter-spacing: 0;
}

.topbar-actions,
.toolbar,
.actions,
.form-actions,
.review-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.page-root {
  display: grid;
  gap: 18px;
}

.ai-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 22px;
  overflow: hidden;
}

.ai-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(33, 243, 211, 0.16), transparent 34%),
    linear-gradient(280deg, rgba(157, 92, 255, 0.18), transparent 36%);
  pointer-events: none;
}

.ai-hero > * {
  position: relative;
}

.ai-hero h2 {
  margin-top: 4px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.15;
}

.ai-hero p {
  margin-top: 8px;
  max-width: 680px;
  color: var(--muted-foreground);
  line-height: 1.55;
}

.ai-signal {
  display: grid;
  grid-template-columns: repeat(3, 34px);
  gap: 10px;
  align-items: end;
  min-height: 82px;
}

.ai-signal span {
  display: block;
  border-radius: 999px;
  background: linear-gradient(180deg, #21f3d3, #9d5cff);
  box-shadow: 0 0 24px rgba(33, 243, 211, 0.4);
}

.ai-signal span:nth-child(1) {
  height: 44px;
}

.ai-signal span:nth-child(2) {
  height: 72px;
}

.ai-signal span:nth-child(3) {
  height: 56px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stats-grid.compact {
  margin: 14px 0 0;
}

.manufacturer-stats {
  margin-bottom: 0;
}

.stat-card,
.card,
.dialog-panel,
.empty-state {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  backdrop-filter: blur(18px);
  color: var(--card-foreground);
  box-shadow: var(--shadow);
}

.stat-card {
  display: grid;
  gap: 6px;
  min-height: 96px;
  padding: 18px;
}

.stat-card span {
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
}

.stat-card small {
  color: var(--muted-foreground);
  font-size: 13px;
}

.card {
  overflow: hidden;
}

.card-header,
.card-content,
.card-footer {
  padding: 18px;
}

.card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  display: grid;
  gap: 4px;
}

.card-title h2,
.card-title h3 {
  font-size: 18px;
  line-height: 1.35;
}

.card-title p,
.card-description,
.meta-line,
.copy-line {
  color: var(--muted-foreground);
  line-height: 1.55;
  font-size: 13px;
}

.card-footer {
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.86fr) minmax(440px, 1.14fr);
  gap: 18px;
  align-items: start;
}

.manufacturer-info-card {
  max-width: 860px;
}

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

.btn,
.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, opacity 0.18s ease;
}

.btn:disabled,
.small-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.btn-primary,
.publish-button {
  border-color: rgba(33, 243, 211, 0.32);
  background: linear-gradient(135deg, #21f3d3, #5c8cff);
  color: #04100f;
  box-shadow: 0 0 22px rgba(33, 243, 211, 0.22);
}

.btn-primary:hover,
.publish-button:hover {
  background: linear-gradient(135deg, #66ffe8, #9d5cff);
}

.btn-outline,
.small-button {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.055);
  color: var(--foreground);
}

.btn-outline:hover,
.small-button:hover {
  background: rgba(33, 243, 211, 0.1);
}

.btn-secondary,
.approve-button {
  border-color: rgba(157, 92, 255, 0.3);
  background: rgba(157, 92, 255, 0.18);
  color: #eadcff;
}

.btn-ghost {
  background: transparent;
  color: var(--foreground);
}

.btn-ghost:hover {
  background: var(--secondary);
}

.btn-destructive,
.reject-button {
  background: var(--destructive-soft);
  color: var(--destructive);
}

.btn-destructive:hover,
.reject-button:hover {
  background: #ffe4df;
}

.small-button {
  min-height: 34px;
  padding: 0 11px;
  font-size: 13px;
}

.icon-button {
  width: 36px;
  min-width: 36px;
  padding: 0;
  font-size: 18px;
}

.field-group {
  display: grid;
  gap: 14px;
}

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

.field label,
.field-label {
  color: #dffaf6;
  font-size: 13px;
  font-weight: 800;
}

.field-description {
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 1.45;
}

.switch-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
}

.switch-row span {
  display: grid;
  gap: 3px;
}

.switch-row strong {
  color: #e9fffb;
  font-size: 14px;
}

.switch-row small {
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 1.45;
}

.form-actions {
  justify-content: stretch;
}

.form-actions .btn {
  flex: 1;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 220px)) auto;
  gap: 12px;
  align-items: end;
}

.group-lab {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.group-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.segmented-control,
.channel-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segment,
.channel-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: #dffaf6;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.segment span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  font-size: 12px;
}

.segment:hover,
.segment.active,
.channel-option:has(input:checked) {
  border-color: transparent;
  background: linear-gradient(135deg, #21f3d3, #e8fbf7);
  color: #06100f;
}

.simple-list,
.product-list,
.review-list,
.job-list,
.delivery-list {
  display: grid;
  gap: 12px;
}

.manufacturer-row,
.product-row,
.review-row,
.job-row,
.delivery-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.access-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

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

.permission-pills span,
.permission-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: #dffaf6;
  font-size: 13px;
  font-weight: 800;
}

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

.permission-check {
  justify-content: flex-start;
  border-radius: var(--radius);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.055);
  color: #dffaf6;
  font-size: 13px;
  font-weight: 800;
}

.login-stage {
  display: grid;
  place-items: center;
  width: min(980px, 100%);
  min-height: calc(100vh - 64px);
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(300px, 0.92fr) minmax(340px, 1fr);
  width: 100%;
  min-height: 560px;
  overflow: hidden;
}

.login-visual {
  position: relative;
  display: grid;
  align-content: end;
  gap: 14px;
  min-height: 100%;
  padding: 34px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(33, 243, 211, 0.2), transparent 48%),
    linear-gradient(315deg, rgba(157, 92, 255, 0.22), transparent 52%),
    rgba(3, 13, 16, 0.72);
}

.login-visual::before {
  content: "";
  position: absolute;
  inset: 24px;
  border: 1px solid rgba(33, 243, 211, 0.16);
  border-radius: var(--radius);
  background:
    linear-gradient(rgba(33, 243, 211, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(33, 243, 211, 0.045) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(to bottom, transparent, #000 24%, #000 86%, transparent);
}

.login-visual > * {
  position: relative;
  z-index: 1;
}

.login-brand-mark {
  width: 54px;
  height: 54px;
  font-size: 15px;
}

.login-orbit {
  position: absolute;
  inset: 70px 34px auto auto;
  width: 172px;
  aspect-ratio: 1;
  border: 1px solid rgba(33, 243, 211, 0.22);
  border-radius: 999px;
  box-shadow: inset 0 0 36px rgba(33, 243, 211, 0.1), 0 0 40px rgba(157, 92, 255, 0.18);
}

.login-orbit span {
  position: absolute;
  border-radius: 999px;
  background: rgba(33, 243, 211, 0.72);
  box-shadow: 0 0 22px rgba(33, 243, 211, 0.48);
}

.login-orbit span:nth-child(1) {
  width: 12px;
  height: 12px;
  top: 24px;
  left: 34px;
}

.login-orbit span:nth-child(2) {
  width: 8px;
  height: 8px;
  right: 28px;
  top: 66px;
}

.login-orbit span:nth-child(3) {
  width: 10px;
  height: 10px;
  left: 78px;
  bottom: 22px;
}

.login-visual h2 {
  max-width: 360px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.08;
}

.login-visual p {
  max-width: 360px;
  color: var(--muted-foreground);
  line-height: 1.6;
}

.login-card {
  display: grid;
  align-content: center;
  gap: 22px;
  padding: clamp(26px, 5vw, 46px);
  background: rgba(6, 18, 21, 0.7);
}

.login-form-head {
  display: grid;
  gap: 7px;
}

.login-form-head h2 {
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.12;
}

.login-form-head p {
  color: var(--muted-foreground);
  font-size: 13px;
  line-height: 1.6;
}

.login-submit {
  width: 100%;
  min-height: 46px;
}

.manufacturer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
}

.manufacturer-main,
.product-main {
  min-width: 0;
}

.row-title,
.product-title,
.review-head,
.job-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.row-badges {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.manufacturer-name-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.manufacturer-name-line strong {
  overflow-wrap: anywhere;
}

.row-title strong,
.product-title strong,
.review-head strong,
.job-head strong {
  font-size: 16px;
}

.link-box {
  display: block;
  margin-top: 9px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(1, 8, 10, 0.46);
  color: #b8fff3;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.manufacturer-actions,
.product-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.product-row {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 14px;
}

.thumb {
  width: 108px;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--muted);
  object-fit: cover;
}

.product-actions {
  min-width: 128px;
}

.badge,
.status-chip,
.credit-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  color: var(--secondary-foreground);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.credit-badge {
  min-width: 28px;
  border: 1px solid rgba(246, 198, 111, 0.5);
  background: rgba(246, 198, 111, 0.16);
  color: #f6c66f;
  box-shadow: 0 0 18px rgba(246, 198, 111, 0.12);
}

.status-pending {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-ready {
  background: var(--success-soft);
  color: var(--success);
}

.status-blocked {
  background: var(--destructive-soft);
  color: var(--destructive);
}

.status-muted {
  background: var(--secondary);
  color: var(--muted-foreground);
}

.listing-grid,
.risk-list,
.ocr-field-grid {
  display: grid;
  gap: 8px;
}

.listing-grid {
  margin-top: 10px;
}

.listing {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted-foreground);
  font-size: 13px;
}

.risk {
  padding: 9px 10px;
  border-radius: var(--radius);
  background: var(--destructive-soft);
  color: var(--destructive);
  font-size: 13px;
  line-height: 1.45;
}

.review-row,
.job-row,
.delivery-row {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.ocr-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ocr-mini-grid span {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
  color: #dffaf6;
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.uploaded-file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: 8px;
}

.uploaded-file-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(1, 8, 10, 0.42);
  color: #dffaf6;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
}

.uploaded-file-card:hover {
  border-color: rgba(33, 243, 211, 0.5);
  background: rgba(33, 243, 211, 0.08);
}

.uploaded-file-card img,
.file-icon {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
}

.uploaded-file-card img {
  object-fit: cover;
}

.file-icon {
  display: grid;
  place-items: center;
  color: var(--muted-foreground);
  letter-spacing: 0;
}

.uploaded-file-card span:last-child {
  overflow-wrap: anywhere;
}

.file-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.file-gallery-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(1, 8, 10, 0.46);
  color: #dffaf6;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.file-gallery-card:hover {
  border-color: rgba(33, 243, 211, 0.56);
  background: rgba(33, 243, 211, 0.08);
  transform: translateY(-2px);
}

.uploaded-file-card:disabled,
.file-gallery-card:disabled {
  cursor: default;
  opacity: 0.72;
}

.file-gallery-card img,
.file-gallery-card .file-icon {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  object-fit: cover;
}

.file-gallery-card strong,
.file-gallery-card span,
.file-gallery-card small {
  overflow-wrap: anywhere;
}

.file-gallery-card span,
.file-gallery-card small,
.report-summary-line {
  color: var(--muted-foreground);
  font-size: 13px;
  line-height: 1.45;
}

.report-summary-line {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.report-document-list {
  display: grid;
  gap: 16px;
}

.report-document {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(33, 243, 211, 0.1), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.026));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 18px 48px rgba(0, 0, 0, 0.22);
}

.report-document::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(154, 255, 237, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(154, 255, 237, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent 72%);
}

.report-document > * {
  position: relative;
  z-index: 1;
}

.report-document-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.report-document-head > div {
  min-width: 0;
}

.report-document-head h3 {
  margin: 4px 0;
  font-size: 18px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.report-document-head p {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.report-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.report-field {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(154, 255, 237, 0.14);
  border-radius: 7px;
  background: rgba(1, 8, 10, 0.32);
}

.report-field strong {
  display: block;
  margin-bottom: 5px;
  color: #8deee0;
  font-size: 12px;
  font-weight: 600;
}

.report-field span {
  display: block;
  color: #eefbf8;
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.dynamic-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(154, 255, 237, 0.14);
  border-radius: var(--radius);
  background: rgba(1, 8, 10, 0.32);
}

.dynamic-report-table {
  min-width: 680px;
}

.dynamic-report-table th {
  background: rgba(33, 243, 211, 0.08);
}

.dynamic-report-table th,
.dynamic-report-table td {
  white-space: nowrap;
}

.dynamic-report-table td {
  max-width: 240px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.035);
  border-style: dashed;
  color: var(--muted-foreground);
  text-align: center;
  box-shadow: none;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(23, 23, 23, 0.48);
}

.dialog-panel {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

body.modal-open {
  overflow: hidden;
}

.image-preview-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(1, 8, 10, 0.78);
  backdrop-filter: blur(12px);
}

.image-preview-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1100px, 100%);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(5, 15, 18, 0.96);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.48), 0 0 40px rgba(33, 243, 211, 0.14);
}

.image-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.image-preview-head > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.image-preview-head strong,
.image-preview-head span {
  overflow-wrap: anywhere;
}

.image-preview-head span {
  color: var(--muted-foreground);
  font-size: 13px;
}

.image-preview-stage {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 14px;
  overflow: auto;
}

.image-preview-stage img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 150px);
  border-radius: 6px;
  object-fit: contain;
}

.hidden {
  display: none !important;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
  font-size: 14px;
}

.report-table {
  min-width: 1480px;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  color: #cce7e4;
  background: rgba(255, 255, 255, 0.055);
  font-size: 13px;
}

.report-table td {
  max-width: 220px;
  overflow-wrap: anywhere;
}

.table-manufacturer-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.table-manufacturer-name span:last-child {
  overflow-wrap: anywhere;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.small-button.disabled {
  opacity: 0.5;
  pointer-events: none;
}

td a {
  color: var(--primary);
  font-weight: 900;
  text-decoration: none;
}

.standalone-upload {
  display: grid;
  gap: 16px;
  width: min(960px, 100%);
}

.simple-upload-brand {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  width: 100%;
}

.simple-upload-brand .eyebrow {
  color: var(--primary);
  font-size: 13px;
  font-weight: 900;
}

.simple-upload-brand h1 {
  margin-top: 2px;
  overflow-wrap: anywhere;
  font-size: clamp(24px, 5vw, 34px);
  line-height: 1.18;
}

.simple-upload-card {
  width: 100%;
  border-color: rgba(33, 243, 211, 0.28);
}

.simple-upload-card .card-content {
  padding: 20px;
}

.simple-upload-card .card-footer {
  padding: 16px 20px;
}

.simple-upload-card .btn {
  width: 100%;
}

.public-upload-header {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.public-upload-header h1 {
  margin-top: 3px;
  font-size: clamp(24px, 4vw, 34px);
}

.upload-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(300px, 0.72fr);
  gap: 18px;
  align-items: start;
}

.file-input {
  border: 1px dashed var(--input);
  background: rgba(2, 10, 12, 0.56);
  color: var(--foreground);
}

.file-input::file-selector-button {
  margin-right: 12px;
  border: 0;
  border-radius: 6px;
  padding: 8px 11px;
  background: rgba(33, 243, 211, 0.16);
  color: var(--foreground);
  font-weight: 800;
}

.ocr-result {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(2, 10, 12, 0.42);
  color: var(--foreground);
}

.ocr-result.empty-state {
  min-height: 98px;
  margin: 0;
}

.ocr-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.ocr-field {
  display: grid;
  gap: 4px;
  padding: 9px;
  border-radius: var(--radius);
  background: var(--card);
}

.ocr-field strong {
  color: var(--muted-foreground);
  font-size: 12px;
}

.ocr-field span {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.ocr-table-section {
  display: grid;
  gap: 8px;
}

.ocr-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.ocr-line-table {
  min-width: 900px;
}

.ocr-line-table th,
.ocr-line-table td {
  padding: 10px;
  white-space: nowrap;
}

.ocr-line-table td:nth-child(3),
.ocr-line-table td:nth-child(10) {
  white-space: normal;
  min-width: 110px;
}

.ocr-raw {
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.ocr-raw summary {
  cursor: pointer;
  color: var(--primary);
  font-size: 13px;
  font-weight: 900;
}

.ocr-raw pre {
  max-height: 260px;
  margin: 10px 0 0;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(1, 8, 10, 0.64);
  color: #d9f8f2;
  white-space: pre-wrap;
  word-break: break-word;
}

.image-processing-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.9fr) minmax(420px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.image-studio-hero {
  min-height: 126px;
}

.compact-switch {
  margin-bottom: 10px;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.field-label-row label {
  margin: 0;
}

.field-label-row .small-button {
  white-space: nowrap;
}

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

.image-size-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(1, 8, 10, 0.36);
  color: #dffaf6;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.image-size-option:has(input:checked) {
  border-color: rgba(33, 243, 211, 0.48);
  background: linear-gradient(135deg, rgba(33, 243, 211, 0.16), rgba(157, 92, 255, 0.14));
  box-shadow: inset 0 0 0 1px rgba(33, 243, 211, 0.1);
}

.selected-file-list .empty-state {
  min-height: 86px;
  box-shadow: none;
}

.image-source-panel {
  display: grid;
  gap: 10px;
}

.image-source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 10px;
}

.compact-source-grid {
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
}

.image-source-card {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 7px;
  border: 1px solid rgba(154, 255, 237, 0.16);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(33, 243, 211, 0.08), transparent 48%),
    rgba(1, 8, 10, 0.4);
  color: #dffaf6;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.image-source-card:hover {
  border-color: rgba(33, 243, 211, 0.56);
  background: rgba(33, 243, 211, 0.08);
  transform: translateY(-2px);
}

.image-source-card img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  object-fit: cover;
}

.image-source-card span {
  min-width: 0;
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.selected-files {
  display: grid;
  gap: 8px;
}

.selected-files span {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
  color: #dffaf6;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.image-result-head,
.image-job-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.image-result-head {
  margin-bottom: 14px;
}

.image-processing-loading {
  display: grid;
  gap: 16px;
  padding: 14px;
  border: 1px solid rgba(33, 243, 211, 0.22);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(33, 243, 211, 0.1), transparent 45%),
    rgba(1, 8, 10, 0.42);
  box-shadow: inset 0 0 0 1px rgba(33, 243, 211, 0.06);
}

.active-image-jobs,
.recent-image-jobs {
  display: grid;
  gap: 12px;
}

.recent-image-jobs {
  margin-top: 16px;
}

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

.loading-pulse {
  display: inline-flex;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(154, 255, 237, 0.14);
  border-radius: 999px;
  background: rgba(1, 8, 10, 0.4);
}

.loading-pulse span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--primary);
  animation: pulse-dot 1.05s ease-in-out infinite;
}

.loading-pulse span:nth-child(2) {
  animation-delay: 0.16s;
}

.loading-pulse span:nth-child(3) {
  animation-delay: 0.32s;
}

.ai-progress-bar {
  position: relative;
  height: 12px;
  overflow: hidden;
  border: 1px solid rgba(33, 243, 211, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.ai-progress-bar span {
  position: absolute;
  inset: 0 auto 0 -38%;
  width: 38%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(33, 243, 211, 0.1), rgba(33, 243, 211, 0.95), rgba(157, 92, 255, 0.8));
  box-shadow: 0 0 18px rgba(33, 243, 211, 0.32);
  animation: ai-progress-scan 1.4s ease-in-out infinite;
}

.progress-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.progress-steps span {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgba(154, 255, 237, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: #dffaf6;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.processing-source-block {
  display: grid;
  gap: 10px;
}

.image-job-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.image-job-list,
.image-history-grid,
.image-result-grid,
.image-detail-grid {
  display: grid;
  gap: 12px;
}

.image-history-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.image-job-row {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.image-history-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(33, 243, 211, 0.09), transparent 42%),
    rgba(255, 255, 255, 0.04);
}

.image-history-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-height: 150px;
  padding: 6px;
  border: 1px solid rgba(154, 255, 237, 0.14);
  border-radius: var(--radius);
  background: rgba(1, 8, 10, 0.42);
}

.image-history-preview img,
.image-history-preview span {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
}

.image-history-preview img {
  object-fit: cover;
  background: rgba(255, 255, 255, 0.06);
}

.image-history-preview span {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  color: var(--muted-foreground);
  font-size: 13px;
}

.image-history-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.image-history-body .meta-line {
  overflow-wrap: anywhere;
}

.image-detail-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.image-detail-meta div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(154, 255, 237, 0.14);
  border-radius: var(--radius);
  background: rgba(1, 8, 10, 0.32);
}

.image-detail-meta strong,
.image-detail-meta span {
  display: block;
  overflow-wrap: anywhere;
}

.image-detail-meta strong {
  margin-bottom: 5px;
  color: #8deee0;
  font-size: 12px;
}

.image-detail-meta span {
  color: #eefbf8;
  font-size: 13px;
}

.image-result-grid {
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
}

.image-detail-grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.image-result-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(1, 8, 10, 0.42);
  color: #dffaf6;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.image-result-card:hover {
  border-color: rgba(33, 243, 211, 0.56);
  background: rgba(33, 243, 211, 0.08);
  transform: translateY(-2px);
}

.image-result-card img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  object-fit: cover;
}

.image-result-card strong,
.image-result-card span {
  overflow-wrap: anywhere;
}

.image-result-card span {
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 1.4;
}

@keyframes ai-progress-scan {
  0% {
    transform: translateX(0);
  }

  55%,
  100% {
    transform: translateX(360%);
  }
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.82);
  }

  45% {
    opacity: 1;
    transform: scale(1);
  }
}

.image-failure-list {
  margin-top: 14px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  min-width: 240px;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  background: #171717;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

body.upload-standalone {
  background: var(--background);
}

body.upload-standalone .app-shell {
  display: block;
  min-height: 100vh;
}

body.upload-standalone .sidebar,
body.upload-standalone .topbar,
body.upload-standalone .stats-grid {
  display: none;
}

body.upload-standalone .main-shell {
  display: grid;
  place-items: start center;
  min-height: 100vh;
  padding: 32px 16px;
}

body.login-mode .main-shell {
  place-items: center;
  padding: 24px;
}

body.login-mode .page-root {
  width: 100%;
  place-items: center;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .sidebar-card {
    margin-top: 0;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  }

  .workspace-grid,
  .upload-grid,
  .image-processing-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .login-stage {
    min-height: auto;
  }

  .login-shell {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .login-visual {
    min-height: 260px;
  }

  .login-orbit {
    inset: 44px 28px auto auto;
    width: 136px;
  }
}

@media (max-width: 760px) {
  .main-shell,
  .sidebar {
    padding: 16px;
  }

  .topbar,
  .card-header {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions,
  .toolbar,
  .actions,
  .manufacturer-actions,
  .product-actions,
  .review-actions {
    justify-content: stretch;
  }

  .topbar-actions .btn,
  .toolbar .btn,
  .manufacturer-actions .small-button,
  .product-actions .small-button,
  .review-actions .small-button {
    flex: 1;
  }

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

  .stats-grid,
  .data-grid,
  .ocr-field-grid,
  .ocr-summary-grid,
  .image-detail-meta {
    grid-template-columns: 1fr 1fr;
  }

  .filter-bar,
  .manufacturer-row,
  .product-row,
  .access-row,
  .ocr-mini-grid,
  .image-size-grid,
  .group-lab,
  .ai-hero {
    grid-template-columns: 1fr;
  }

  .image-result-head,
  .image-job-row,
  .image-job-actions,
  .field-label-row,
  .loading-head {
    align-items: stretch;
    flex-direction: column;
  }

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

  .thumb {
    width: 100%;
    max-width: 160px;
  }

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

  body.login-mode .main-shell {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .stats-grid,
  .data-grid,
  .ocr-field-grid,
  .ocr-summary-grid,
  .image-detail-meta,
  .image-history-grid,
  .nav {
    grid-template-columns: 1fr;
  }

  .dialog-backdrop {
    padding: 12px;
  }
}
