:root {
  --bg: #070708;
  --panel: rgba(18, 18, 20, 0.88);
  --panel-strong: #151518;
  --line: rgba(255, 255, 255, 0.12);
  --text: #f7f7f8;
  --muted: #a6a7ad;
  --accent: #e0292f;
  --accent-2: #ff4a50;
  --accent-soft: rgba(224, 41, 47, 0.16);
  --warning: #ffd166;
  --danger: #ff5d63;
  --ok: #45df87;
  --shadow: 0 26px 90px rgba(0, 0, 0, 0.48);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body {
  background:
    radial-gradient(circle at 9% -8%, rgba(224, 41, 47, 0.30), transparent 34rem),
    radial-gradient(circle at 88% 3%, rgba(255, 74, 80, 0.12), transparent 26rem),
    radial-gradient(circle at 50% 105%, rgba(255, 255, 255, 0.055), transparent 34rem),
    linear-gradient(135deg, #050506 0%, #101013 48%, #070708 100%);
}

a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }

.app-shell { width: min(1440px, 100%); margin: 0 auto; padding: 20px; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 14px 0 22px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 52px; height: 52px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(224, 41, 47, 0.38);
  display: grid; place-items: center; overflow: hidden;
  box-shadow: 0 0 34px rgba(224, 41, 47, 0.22), inset 0 0 22px rgba(255,255,255,0.035);
}
.brand h1 { margin: 0; font-size: clamp(1.15rem, 2vw, 1.6rem); letter-spacing: -0.03em; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 0.92rem; }
.nav { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; }
.nav a, .pill {
  border: 1px solid var(--line); color: var(--text); text-decoration: none;
  padding: 9px 12px; border-radius: 999px; background: rgba(255,255,255,0.04);
  font-size: 0.9rem;
}
.nav a:hover, .pill:hover { border-color: rgba(224, 41, 47, 0.72); }

.hero {
  display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.35fr); gap: 18px;
  align-items: stretch;
}
.panel, .card {
  border: 1px solid var(--line); background: var(--panel); border-radius: 24px;
  box-shadow: var(--shadow); backdrop-filter: blur(18px);
}
.panel { padding: 20px; }
.card { padding: 16px; }
.card.compact { padding: 12px; }
.section-title { margin: 0 0 12px; font-size: 1.02rem; letter-spacing: -0.02em; }
.kicker { color: var(--accent-2); text-transform: uppercase; letter-spacing: 0.13em; font-size: 0.75rem; font-weight: 800; }
.big-title { font-size: clamp(2rem, 5vw, 4.2rem); line-height: 0.96; letter-spacing: -0.07em; margin: 12px 0; }
.subtitle { color: var(--muted); font-size: 1.02rem; line-height: 1.65; margin: 0 0 18px; }

.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn {
  border: 1px solid rgba(224, 41, 47, 0.34); background: rgba(224, 41, 47, 0.12);
  color: var(--text); border-radius: 14px; padding: 11px 14px; font-weight: 750;
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
}
.btn:hover { background: rgba(224, 41, 47, 0.2); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #ffffff; border: 0; }
.btn.ghost { background: rgba(255,255,255,0.045); border-color: var(--line); color: var(--text); }
.btn.danger { border-color: rgba(255,107,107,0.45); background: rgba(255,107,107,0.11); }

.field { display: grid; gap: 7px; margin-bottom: 12px; }
.field label { color: var(--muted); font-size: 0.86rem; font-weight: 700; }
.input, select, textarea {
  width: 100%; border: 1px solid var(--line); background: rgba(1, 8, 18, 0.55); color: var(--text);
  border-radius: 14px; padding: 11px 12px; outline: none;
}
.input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(224,41,47,0.16); }
textarea { min-height: 86px; resize: vertical; }

.viewer-wrap { min-height: 530px; position: relative; overflow: hidden; }
.viewer { width: 100%; height: 100%; min-height: 530px; border-radius: 24px; overflow: hidden; }
.viewer-toolbar {
  position: absolute; left: 14px; top: 14px; right: 14px; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; pointer-events: none;
}
.viewer-toolbar > * { pointer-events: auto; }
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(2, 12, 24, 0.68); color: var(--text); font-size: 0.78rem; font-weight: 750;
}
.badge.ok { border-color: rgba(77,229,161,0.42); color: #d8ffe7; }
.badge.warn { border-color: rgba(255,209,102,0.5); color: #ffe7a8; }
.badge.danger { border-color: rgba(255,107,107,0.42); color: #ffc1c1; }

.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.stat { padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,0.045); }
.stat small { color: var(--muted); display: block; margin-bottom: 4px; }
.stat strong { font-size: 1.1rem; }

.camera-box { position: relative; min-height: 220px; border-radius: 20px; overflow: hidden; background: #020914; border: 1px solid var(--line); }
.camera-box video { width: 100%; height: 100%; min-height: 220px; object-fit: cover; display: block; }
.camera-overlay {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(rgba(224,41,47,0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(224,41,47,0.18) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, transparent, black 14%, black 86%, transparent);
}
.camera-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); padding: 24px; text-align: center; }

.scan-list { display: grid; gap: 10px; max-height: 620px; overflow: auto; padding-right: 4px; }
.scan-item {
  display: grid; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 16px;
  background: rgba(255,255,255,0.04); text-align: left;
}
.scan-item:hover, .scan-item.active { border-color: rgba(224,41,47,0.68); background: rgba(224,41,47,0.11); }
.scan-item strong { display: block; font-size: 0.98rem; }
.scan-item span { color: var(--muted); font-size: 0.8rem; }

.table { width: 100%; border-collapse: collapse; overflow: hidden; }
.table th, .table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { color: var(--muted); font-size: 0.8rem; }
.table td { font-size: 0.9rem; }

.toast {
  position: fixed; z-index: 50; right: 18px; bottom: 18px; max-width: min(420px, calc(100vw - 36px));
  background: rgba(5, 15, 27, 0.96); border: 1px solid rgba(224,41,47,0.45); color: var(--text);
  padding: 13px 14px; border-radius: 16px; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px);
  transition: 0.2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

.notice { border-left: 4px solid var(--warning); padding: 12px 14px; background: rgba(255,209,102,0.1); border-radius: 14px; color: #fff1c4; line-height: 1.55; }
.notice.ok { border-color: var(--ok); background: rgba(77,229,161,0.1); color: #d9fff0; }
.notice.info { border-color: var(--accent); background: rgba(224,41,47,0.09); color: #ffe1e3; }

.workflow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.workflow .step { border: 1px solid var(--line); border-radius: 18px; padding: 12px; background: rgba(255,255,255,0.04); }
.workflow .step strong { display:block; margin-bottom:5px; }
.workflow .step span { color: var(--muted); font-size:0.85rem; line-height:1.45; }

.footer { color: var(--muted); padding: 24px 0 10px; font-size: 0.88rem; }

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .grid.two, .grid.three, .grid.four, .stats, .workflow { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .nav { justify-content: flex-start; }
  .viewer, .viewer-wrap { min-height: 420px; }
}

@media (max-width: 560px) {
  .app-shell { padding: 14px; }
  .panel { padding: 15px; border-radius: 20px; }
  .viewer, .viewer-wrap { min-height: 360px; }
  .big-title { font-size: 2.2rem; }
}

/* Logo and customer-sample presentation */
.logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand-badge { display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 999px; border: 1px solid rgba(224,41,47,0.34); background: rgba(224,41,47,0.09); color: #ffd6d8; font-weight: 800; font-size: 0.78rem; }
.sample-gallery { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.sample-card { overflow: hidden; padding: 0; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.025)); border-radius: 20px; box-shadow: var(--shadow); }
.sample-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; border-bottom: 1px solid var(--line); background: #09090a; }
.sample-card-body { padding: 12px; display: grid; gap: 8px; }
.sample-card h4 { margin: 0; font-size: 0.96rem; line-height: 1.28; letter-spacing: -0.02em; }
.sample-card p { margin: 0; color: var(--muted); font-size: 0.82rem; line-height: 1.45; }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; border: 1px solid rgba(255,255,255,0.11); border-radius: 999px; padding: 5px 8px; font-size: 0.72rem; color: #dadadd; background: rgba(255,255,255,0.04); }
.product-frame { border-radius: 28px; border: 1px solid rgba(224,41,47,0.22); background: linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.022)); overflow: hidden; }
.preview-hero { width: 100%; border-radius: 20px; border: 1px solid var(--line); display: block; box-shadow: 0 18px 60px rgba(0,0,0,0.38); }
.scan-item { grid-template-columns: 76px minmax(0, 1fr); align-items: center; }
.scan-thumb { width: 64px; height: 44px; border-radius: 10px; object-fit: cover; border: 1px solid rgba(255,255,255,0.12); background: #080809; }
.scan-copy { display: grid; gap: 5px; min-width: 0; }
.scan-copy strong, .scan-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-preview { width: 100%; border-radius: 16px; border: 1px solid var(--line); margin-bottom: 12px; display: block; }
.hero.hero-wide { grid-template-columns: minmax(0, 1fr) minmax(420px, 1.25fr); }
@media (max-width: 1180px) { .sample-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) { .sample-gallery { grid-template-columns: 1fr; } .scan-item { grid-template-columns: 66px minmax(0, 1fr); } .scan-thumb { width: 56px; height: 40px; } }
