:root {
    --color-bg: #f6f5f1;
    --color-surface: #ffffff;
    --color-border: #e3e0d6;
    --color-text: #1c1a14;
    --color-muted: #6b6659;
    --color-primary: #f6ab05;
    --color-primary-hover: #d99200;
    --color-ink: #17150f;
    --color-ink-soft: #2a271d;
    --color-warning-bg: #fff8e6;
    --color-warning-border: #f0c36d;
    --radius: 10px;
    --font-heading: "Poppins", "Segoe UI", sans-serif;
    --font-body: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-body);
    background-color: var(--color-bg);
    background-image: radial-gradient(circle, #e6e2d3 1px, transparent 1px);
    background-size: 22px 22px;
    color: var(--color-text);
    font-size: 15px;
    line-height: 1.5;
}

.mono {
    font-family: var(--font-mono);
    font-size: 0.93em;
}

.site-header {
    background: var(--color-ink);
    border-bottom: 3px solid var(--color-primary);
}

.site-header__inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.site-brand__logo {
    height: 30px;
    width: auto;
    display: block;
}

.site-brand__divider {
    width: 1px;
    height: 22px;
    background: #3a362a;
}

.site-brand__name {
    color: #9c9788;
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.01em;
}

.site-brand__cursor {
    color: var(--color-primary);
    animation: blink 1.1s step-end infinite;
}

@media (prefers-reduced-motion: reduce) {
    .site-brand__cursor { animation: none; }
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.site-nav {
    display: flex;
    gap: 18px;
}

.site-nav a {
    color: #cfccc0;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    padding: 6px 2px;
    border-bottom: 2px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.site-nav a:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.page {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.page-header p {
    margin: 4px 0 0;
    color: var(--color-muted);
}

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(23, 21, 15, 0.04);
}

.card h2 {
    margin: 0 0 16px;
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-ink-soft);
}

.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.form-field {
    flex: 1 1 260px;
    margin-bottom: 16px;
}

.form-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

.form-field input[type="text"],
.form-field input[type="password"],
.form-field input[type="email"],
.form-field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 15px;
}

.form-field input[type="text"]:focus,
.form-field input[type="password"]:focus,
.form-field input[type="email"]:focus,
.form-field select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(246, 171, 5, 0.25);
}

.login-page {
    max-width: 400px;
    margin: 80px auto;
    padding: 0 16px;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-ink);
    border: none;
    border-radius: var(--radius);
    padding: 12px 22px;
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
}

.btn-primary:active {
    transform: translateY(1px);
}

.status-line {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-muted);
    flex-shrink: 0;
}

.status-line--connected .status-dot {
    background: #2f9e44;
}

.status-line--not_configured .status-dot,
.status-line--not_checked .status-dot {
    background: var(--color-muted);
}

.status-line--auth_error .status-dot,
.status-line--forbidden .status-dot,
.status-line--connection_error .status-dot,
.status-line--invalid_response .status-dot,
.status-line--server_error .status-dot {
    background: #e03131;
}

.status-line--rate_limited .status-dot {
    background: #f08c00;
}

.status-line {
    margin-bottom: 12px;
}

.notice {
    background: var(--color-warning-bg);
    border: 1px solid var(--color-warning-border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 20px;
}

.notice--found {
    background: #ebfbee;
    border-color: #2f9e44;
}

.notice--not_found {
    background: #f1f3f5;
    border-color: var(--color-border);
}

.notice--validation_error {
    background: var(--color-warning-bg);
    border-color: var(--color-warning-border);
}

.notice--partial_match,
.notice--duplicate {
    background: #fff8e6;
    border-color: #f08c00;
}

.notice--matched {
    background: #ebfbee;
    border-color: #2f9e44;
}

.notice--conflict,
.notice--error {
    background: #fff5f5;
    border-color: #e03131;
}

.notice--source-confirmed,
.notice--source-confirmed_by_official_catalog,
.notice--source-official_archive_match {
    background: #ebfbee;
    border-color: #2f9e44;
}

.notice--source-probable,
.notice--source-ambiguous,
.notice--source-source_unavailable {
    background: #fff8e6;
    border-color: #f08c00;
}

.notice--source-not_found,
.notice--source-unsupported,
.notice--source-validation_error {
    background: #f1f3f5;
    border-color: var(--color-border);
}

.notice--source-conflict {
    background: #fff5f5;
    border-color: #e03131;
}

.notice--manufacturer-source_data_ready {
    background: #ebfbee;
    border-color: #2f9e44;
}

.notice--manufacturer-partial_source_data {
    background: #fff8e6;
    border-color: #f08c00;
}

.notice--manufacturer-source_data_conflict {
    background: #fff5f5;
    border-color: #e03131;
}

.empty-state {
    color: var(--color-muted);
    font-style: italic;
}

h3 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--color-ink);
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

@media (max-width: 640px) {
    .result-grid {
        grid-template-columns: 1fr;
    }
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.gallery-item {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 8px;
    background: var(--color-bg);
}

.gallery-item--primary {
    border-color: var(--color-primary);
    border-width: 2px;
}

.gallery-item img {
    width: 100%;
    height: 140px;
    object-fit: contain;
    background: #fff;
    border-radius: 4px;
    margin-bottom: 8px;
}

.gallery-item__meta {
    font-size: 12px;
    line-height: 1.5;
}

.doc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.doc-table th,
.doc-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--color-border);
}

.doc-table th {
    color: var(--color-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.03em;
}

/* Etap 6A - ekran weryfikacji pracownika */

.progress-bar {
    background: var(--color-bg);
    border-radius: 999px;
    height: 14px;
    overflow: hidden;
    margin: 10px 0 6px;
}

.progress-bar__fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 999px;
}

.progress-summary {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: var(--color-muted);
}

.pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.pill--green {
    background: #ebfbee;
    color: #2f9e44;
}

.pill--yellow {
    background: #fff8e6;
    color: #b3790a;
}

.pill--red {
    background: #fff5f5;
    color: #c92a2a;
}

.pill--grey {
    background: #f1f3f5;
    color: var(--color-muted);
}

.batch-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.batch-summary__item {
    min-width: 120px;
}

.batch-summary__value {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 800;
    color: var(--color-ink);
}

.batch-summary__label {
    font-size: 12px;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.terminal {
    background: var(--color-ink);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--color-ink);
}

.terminal__titlebar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 12px;
    background: var(--color-ink-soft);
}

.terminal__dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #55503f;
}

.terminal__label {
    margin-left: 8px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: #9c9788;
}

textarea.import-textarea {
    display: block;
    width: 100%;
    min-height: 160px;
    padding: 14px 16px;
    border: none;
    border-radius: 0;
    background: var(--color-ink);
    color: #f2f0ea;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
}

textarea.import-textarea::placeholder {
    color: #5c5847;
}

textarea.import-textarea:focus {
    outline: none;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.results-table th,
.results-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

.results-table th {
    color: var(--color-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.03em;
}

.inline-form {
    display: inline;
}

.btn-tiny {
    background: #fff;
    color: var(--color-ink);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    margin: 0 2px 2px 0;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.btn-tiny:hover {
    border-color: var(--color-primary);
    background: #fffaf0;
}

.checklist {
    list-style: none;
    margin: 0;
    padding: 0;
}

.checklist__item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
}

.checklist__item:last-child {
    border-bottom: none;
}

.checklist__marker {
    flex-shrink: 0;
    font-weight: 700;
}

.checklist__item--green .checklist__marker { color: #2f9e44; }
.checklist__item--yellow .checklist__marker { color: #b3790a; }
.checklist__item--red .checklist__marker { color: #c92a2a; }

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.field-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.thumb {
    width: 96px;
    height: 96px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.kv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.kv-table td {
    padding: 4px 8px 4px 0;
    vertical-align: top;
}

.kv-table td:first-child {
    color: var(--color-muted);
    white-space: nowrap;
    width: 220px;
}

details.tech-details {
    margin-top: 12px;
    font-size: 13px;
}

details.tech-details summary {
    cursor: pointer;
    color: var(--color-muted);
    font-weight: 600;
}

.btn-secondary {
    background: var(--color-ink);
    color: #f2f0ea;
    border: 1px solid var(--color-ink);
    border-radius: var(--radius);
    padding: 10px 16px;
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-secondary:hover {
    background: var(--color-ink-soft);
}
