/* ── Typography ── */
h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 1.25rem;
    letter-spacing: -0.015em;
}

h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
}

h1:focus {
    outline: none;
}

p {
    margin: 0 0 0.75rem;
}

a {
    color: #1d4ed8;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ── Sections ── */
section {
    background: #ffffff;
    border: 1px solid #e7e5e4;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

section.upload {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.filter-row {
    margin-bottom: 1rem;
}

/* ── Data table ── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid #e7e5e4;
}

.data-table th {
    background: #fafaf9;
    color: #57534e;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.03em;
}

.data-table tbody tr:hover {
    background: #fafaf9;
}

.data-table td a {
    font-weight: 500;
}

/* ── Scan detail grid ── */
.scan-detail {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) 1fr;
    gap: 2rem;
    align-items: start;
}

.scan-detail img {
    max-width: 100%;
    border-radius: 6px;
    border: 1px solid #e7e5e4;
    background: #fafaf9;
}

.scan-detail details {
    margin-top: 0.75rem;
    font-size: 0.85rem;
}

.scan-detail pre {
    background: #fafaf9;
    border: 1px solid #e7e5e4;
    border-radius: 4px;
    padding: 0.75rem;
    font-size: 0.75rem;
    overflow-x: auto;
    max-height: 320px;
}

@media (max-width: 800px) {
    .scan-detail {
        grid-template-columns: 1fr;
    }
}

/* ── Forms ── */
form label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 0.85rem;
    font-size: 0.85rem;
    color: #44403c;
    font-weight: 500;
}

form input[type="text"],
form input[type="email"],
form input[type="number"],
form input[type="password"],
form select,
form textarea,
form .form-control {
    padding: 0.5rem 0.65rem;
    border: 1px solid #d6d3d1;
    border-radius: 5px;
    font: inherit;
    background: #ffffff;
    color: #171717;
    transition: border-color 0.15s, box-shadow 0.15s;
}

form input:focus,
form select:focus,
form textarea:focus {
    outline: none;
    border-color: #171717;
    box-shadow: 0 0 0 3px rgba(23, 23, 23, 0.08);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

button,
.btn {
    padding: 0.55rem 1.1rem;
    background: #171717;
    color: #fafaf9;
    border: 1px solid #171717;
    border-radius: 5px;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

button:hover:not(:disabled) {
    background: #404040;
    border-color: #404040;
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

button[type="button"] {
    background: #ffffff;
    color: #171717;
    border-color: #d6d3d1;
}

button[type="button"]:hover:not(:disabled) {
    background: #fafaf9;
    border-color: #a8a29e;
}

/* ── Status indicators ── */
.error {
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 5px;
    padding: 0.5rem 0.75rem;
    font-size: 0.88rem;
}

/* ── Category multi-select ── */
.category-fieldset {
    border: 1px solid #d6d3d1;
    border-radius: 6px;
    padding: 0.6rem 0.75rem 0.75rem;
    margin: 0 0 0.75rem;
    background: #fafaf9;
}

.category-fieldset legend {
    padding: 0 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #44403c;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.25rem 0.75rem;
}

.category-check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.88rem;
    font-weight: 400;
    margin: 0;
    cursor: pointer;
}

.category-check input[type="checkbox"] {
    margin: 0;
}

/* ── Blazor form validation (kept) ── */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
    font-size: 0.8rem;
}

.blazor-error-boundary {
    background: #b32121;
    color: white;
    padding: 1rem;
    border-radius: 5px;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

/* ── Devices page ── */
.key-banner {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
}
.key-banner code { font-size: 1.05rem; word-break: break-all; display: block; margin: 8px 0; }
.device-actions button { margin-right: 6px; }
.register-device { margin-top: 24px; max-width: 420px; }
.register-device label { display: block; margin-bottom: 8px; }
.muted-note { color: #6b7280; font-size: .9rem; }

/* ── Shelf tag preview ── */
.tag-panel { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.tag-preview {
    background: #fafaf9;
    border: 1px solid #e7e5e4;
    border-radius: 6px;
    padding: 12px;
    min-width: 200px;
}
/* One printer dot is one image pixel; pixelated stops the browser smoothing the
   dither into a grey smear, which is exactly what a thermal head does not do. */
.tag-preview img {
    display: block;
    image-rendering: pixelated;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
}
.tag-actions { max-width: 420px; }
.tag-actions button { margin-top: 8px; }

/* ── Scan pipeline badges ── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .8rem; white-space: nowrap; }
.badge-pending { background: #e0e7ff; color: #3730a3; }
.badge-ok { background: #dcfce7; color: #166534; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-fail { background: #fee2e2; color: #991b1b; }
.badge-neutral { background: #e7e5e4; color: #57534e; }
