body.cert-form-page {
    font-family: Arial, sans-serif;
    margin: 0;
    background: #f1f5f9;
    color: #1e293b;
}

.cert-form-header {
    background: #0f172a;
    color: #fff;
    padding: 16px 20px;
}

.cert-form-header h1 {
    margin: 0 0 4px;
    font-size: 22px;
}

.cert-form-header .sub {
    font-size: 13px;
    opacity: 0.85;
}

.cert-form-main {
    max-width: 900px;
    margin: 20px auto;
    padding: 0 16px 40px;
}

.cert-card {
    background: #fff;
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.cert-card h2 {
    margin: 0 0 12px;
    font-size: 17px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 8px;
}

.cert-card label {
    display: block;
    margin: 10px 0 4px;
    font-weight: 700;
    font-size: 14px;
}

.cert-card input,
.cert-card select,
.cert-card textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
}

.cert-card textarea {
    min-height: 72px;
    resize: vertical;
}

.cert-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 640px) {
    .cert-row {
        grid-template-columns: 1fr;
    }
}

.cert-type-options {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin: 8px 0;
}

.cert-type-options label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    margin: 0;
}

.product-block {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    background: #f8fafc;
}

.product-block h3 {
    margin: 0 0 10px;
    font-size: 15px;
}

.product-fields-special,
.product-fields-annual {
    display: none;
}

.cert-form-page[data-cert-type="annual"] .product-fields-annual {
    display: block;
}

.cert-form-page[data-cert-type="special"] .product-fields-special {
    display: block;
}

.cert-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.cert-actions button {
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
}

.btn-primary {
    background: #0f766e;
    color: #fff;
}

.btn-secondary {
    background: #e2e8f0;
    color: #1e293b;
}

.btn-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.btn-link {
    background: transparent;
    color: #2563eb;
    text-decoration: underline;
    padding: 8px;
}

#certToast {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-width: 420px;
    margin: 0 auto;
    padding: 12px 16px;
    border-radius: 8px;
    color: #fff;
    z-index: 9999;
    display: none;
}

#certToast.ok { background: #166534; }
#certToast.err { background: #b91c1c; }

.hp-field {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    overflow: hidden;
}

.cert-details {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-top: 12px;
    padding: 0 12px 12px;
}

.cert-details summary {
    cursor: pointer;
    font-weight: 700;
    padding: 12px 4px;
    list-style: none;
}

.cert-details summary::-webkit-details-marker {
    display: none;
}

.cert-details[open] summary {
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 12px;
}

.ingredient-block {
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    background: #f8fafc;
}

.ingredient-block h3 {
    margin: 0 0 8px;
    font-size: 15px;
}

.ingredient-product-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 6px 0 10px;
}

.ingredient-product-links label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
    margin: 0;
    font-size: 13px;
}

.file-hint {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
}

.factory-certs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.factory-cert-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    font-size: 14px;
}

.factory-cert-row.is-active {
    border-color: #3b82f6;
    background: #eff6ff;
}

.factory-cert-row.is-expired {
    opacity: 0.75;
}

.factory-cert-row .cert-meta {
    flex: 1;
    min-width: 160px;
}

.factory-cert-row .cert-actions-inline {
    display: flex;
    gap: 6px;
}

.ing-catalog-search-wrap {
    position: relative;
}

.ing-catalog-suggestions {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

.ing-suggestion-item {
    display: block;
    width: 100%;
    text-align: right;
    padding: 8px 12px;
    border: none;
    border-bottom: 1px solid #f1f5f9;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
}

.ing-suggestion-item:hover {
    background: #eff6ff;
}
