:root {
    --line: #d8dde3;
    --muted: #6b7280;
    --ok: #15803d;
    --bad: #b00020;
    --accent: #2563eb;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: #111827;
    background: #f7f8fa;
}

.nav {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 12px 20px;
    background: #1f2937;
    color: #e5e7eb;
}
.nav a { color: #e5e7eb; text-decoration: none; }
.nav a:hover { text-decoration: underline; }
.nav .brand { font-weight: 700; }
.nav .spacer { flex: 1; }

.container { max-width: 1180px; margin: 0 auto; padding: 20px; }

h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

.badge {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 999px;
    background: #374151;
}
.badge.ok { background: var(--ok); color: #fff; }
.badge.bad { background: var(--bad); color: #fff; }

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 11px;
    background: var(--ok);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.btn {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: #111827;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { border-color: #9ca3af; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }

.alert {
    padding: 10px 14px;
    border: 1px solid #f5c2c7;
    background: #fdf2f3;
    color: #842029;
    border-radius: 6px;
    margin-bottom: 14px;
}

.scan-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 20px;
}
@media (max-width: 900px) {
    .scan-layout { grid-template-columns: 1fr; }
}

.stage {
    position: relative;
    height: 62vh;
    background: #111418;
    border-radius: 8px;
    overflow: hidden;
}
.stage video {
    position: absolute;
    left: 50%;
    top: 50%;
    transform-origin: center center;
    background: #000;
}
.placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #d1d5db;
}

.controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.status { color: var(--muted); font-size: 13px; }
.status.error { color: var(--bad); font-weight: 600; }

.sidebar { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px; }

.gallery { display: flex; flex-wrap: wrap; gap: 10px; }
.tile { position: relative; width: 88px; margin: 0; font-size: 11px; color: var(--muted); }
.tile img {
    width: 88px;
    height: 66px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 4px;
    display: block;
    cursor: pointer;
    background: #eef0f3;
}
.tile img:hover { border-color: var(--accent); }
.tile figcaption { margin-top: 3px; }
.tile-delete {
    position: absolute;
    top: -7px;
    right: -7px;
    width: 20px;
    height: 20px;
    line-height: 18px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--bad);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: zoom-out;
}
.lightbox img { max-width: 92%; max-height: 92%; border-radius: 6px; }

.facts { border-collapse: collapse; margin: 14px 0; background: #fff; }
.facts th, .facts td { border: 1px solid var(--line); padding: 8px 14px; text-align: left; }
.facts th { background: #f3f4f6; font-weight: 600; width: 190px; }
.facts .ok { color: var(--ok); font-weight: 700; }
.facts .bad { color: var(--bad); font-weight: 700; }

.verdict { padding: 12px 16px; border-radius: 6px; margin: 14px 0; font-weight: 600; }
.verdict.ok { background: #ecfdf3; color: #15803d; border: 1px solid #a7f3d0; }
.verdict.bad { background: #fdf2f3; color: #842029; border: 1px solid #f5c2c7; }
