
:root {
    --he-green: #059669;
    --he-green-dark: #047857;
    --he-bg: #f0fdf4;
    --he-card: #fff;
    --he-text: #0f172a;
    --he-muted: #64748b;
    --he-border: #d1fae5;
}
.hse-page {
    max-width: 520px;
    margin: 0 auto;
    padding: 16px 14px 48px;
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--he-bg);
    min-height: 100vh;
    box-sizing: border-box;
}
body.hse-entry-page {
    background: var(--he-bg);
}
.hse-top { text-align: center; margin-bottom: 18px; }
.hse-top h1 { margin: 0; font-size: 1.4rem; color: var(--he-green-dark); }
.hse-top p { margin: 8px 0 0; font-size: 0.9rem; color: var(--he-muted); line-height: 1.45; }
.hse-card {
    background: var(--he-card);
    border: 1px solid var(--he-border);
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.08);
}
.hse-ok {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: 0.9rem;
}
.hse-err {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: 0.9rem;
}
.hse-field { margin-bottom: 14px; }
.hse-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--he-text);
    margin-bottom: 5px;
}
.hse-field label .req { color: #dc2626; }
.hse-field input,
.hse-field select,
.hse-field textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
}
.hse-field textarea { min-height: 88px; resize: vertical; }
.hse-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hse-grid .span-full { grid-column: 1 / -1; }
.hse-section {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--he-green-dark);
    margin: 18px 0 10px;
    padding-top: 8px;
    border-top: 1px solid var(--he-border);
}
.hse-section:first-of-type { border-top: none; margin-top: 0; padding-top: 0; }
.hse-section.hidden { display: none; }
.hse-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.hse-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 10px;
    border: none;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}
.hse-btn.primary { background: var(--he-green); color: #fff; }
.hse-btn.ghost { background: #fff; color: var(--he-green-dark); border: 1px solid var(--he-border); }
.hse-links { margin-top: 16px; font-size: 0.85rem; text-align: center; }
.hse-links a { color: var(--he-green-dark); font-weight: 600; }
.hse-scan-card {
    background: #fff;
    border: 1px solid var(--he-border);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.06);
}
.hse-scan-card h2 { margin: 0 0 6px; font-size: 1.05rem; color: var(--he-green-dark); }
.hse-scan-card p { margin: 0 0 12px; font-size: 0.85rem; color: var(--he-muted); line-height: 1.45; }
.hse-scan-btns { display: flex; flex-direction: column; gap: 8px; }
.hse-scan-btns .hse-btn { width: 100%; }
.hse-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.hse-status { font-size: 0.85rem; color: var(--he-muted); margin-top: 10px; min-height: 1.2em; }
.hse-detected {
    display: none;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 12px;
    font-size: 0.85rem;
}
.hse-detected.show { display: block; }
.hse-detected h3 { margin: 0 0 8px; font-size: 0.9rem; color: var(--he-green-dark); }
.hse-detected dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; }
.hse-detected dt { font-weight: 700; color: var(--he-text); }
.hse-detected dd { margin: 0; color: var(--he-muted); word-break: break-word; }
.hse-detected .hse-src { font-weight: 400; font-size: 0.75rem; color: var(--he-muted); }
.hse-detect-hint { margin: 10px 0 0; font-size: 0.8rem; color: var(--he-green-dark); }
.hse-preview { display: none; margin-top: 12px; text-align: center; }
.hse-preview.show { display: block; }
.hse-preview img { max-width: 100%; max-height: 200px; border-radius: 8px; border: 1px solid var(--he-border); }
.hse-preview-cap { display: block; margin-top: 6px; font-size: 0.75rem; color: var(--he-muted); }
.hse-camera { display: none; margin-top: 12px; border-radius: 10px; overflow: hidden; background: #0f172a; }
.hse-camera.open { display: block; }
.hse-camera.hse-scanning { box-shadow: 0 0 0 2px var(--he-green), 0 0 16px rgba(5, 150, 105, 0.35); }
.hse-camera video { width: 100%; display: block; max-height: 280px; object-fit: cover; }
.hse-camera-actions { display: flex; gap: 8px; padding: 10px; background: #1e293b; }
.hse-camera-actions button { flex: 1; padding: 10px; border: none; border-radius: 8px; font-weight: 700; cursor: pointer; }
.hse-filled-note {
    display: none;
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 0.85rem;
}
.hse-filled-note.show { display: block; }
.hse-field-filled { border-color: var(--he-green) !important; box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.15); }
.hse-confirm {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 16px 0 0;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
    line-height: 1.4;
}
.hse-confirm input { margin-top: 3px; flex-shrink: 0; }
.hse-type-intro {
    margin: 0 0 12px;
    padding: 10px 12px;
    background: #f0fdf4;
    border: 1px solid var(--he-border);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--he-muted);
    line-height: 1.45;
}
.hse-panel.hidden { display: none; }
.hse-field-hint {
    margin: 4px 0 0;
    font-size: 0.75rem;
    color: var(--he-muted);
    line-height: 1.35;
}
@media (min-width: 981px) {
    .hse-page {
        max-width: 1200px;
        padding: 28px 32px 64px;
        display: grid;
        grid-template-columns: minmax(320px, 380px) minmax(480px, 1fr);
        grid-template-areas:
            "header header"
            "scan form";
        gap: 24px 28px;
        align-items: start;
        background: transparent;
    }
    .hse-top {
        grid-area: header;
        margin-bottom: 4px;
        text-align: left;
    }
    .hse-top h1 {
        font-size: 1.75rem;
    }
    .hse-top p {
        font-size: 1rem;
        max-width: 720px;
    }
    .hse-scan-card {
        grid-area: scan;
        margin-bottom: 0;
        position: sticky;
        top: 88px;
        padding: 22px;
    }
    .hse-card {
        grid-area: form;
        padding: 24px 28px;
    }
    .hse-scan-btns {
        flex-direction: column;
        gap: 10px;
    }
    .hse-scan-btns .hse-btn {
        width: 100%;
    }
    .hse-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px 16px;
    }
    .hse-field textarea {
        min-height: 100px;
    }
    #hseIngredients {
        min-height: 140px;
    }
    .hse-actions {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;
    }
    .hse-actions .hse-btn {
        flex: 1 1 auto;
        min-width: 200px;
    }
    .hse-links {
        text-align: left;
    }
    .hse-camera.open video {
        max-height: 320px;
    }
    .hse-preview img {
        max-height: 280px;
    }
}
