:root {
    --zahar-ink: #4a2416;
    --zahar-muted: #78584b;
    --zahar-surface: #fffdf8;
    --zahar-card: #ffffff;
    --zahar-border: #f1d6b9;
    --zahar-primary: #c85a18;
    --zahar-primary-dark: #963d12;
    --zahar-warning: #ef9f23;
    --zahar-danger: #cf3131;
}

.zahar-hero {
    padding: 8.75rem 1rem 4.5rem;
    color: #fff;
    text-align: center;
    background:
        radial-gradient(circle at 18% 25%, rgba(255, 218, 130, .58), transparent 25rem),
        radial-gradient(circle at 85% 55%, rgba(156, 63, 11, .35), transparent 27rem),
        linear-gradient(135deg, #6e260d 0%, #b74613 48%, #eb8e1d 100%);
}

.zahar-hero h1 {
    margin: .65rem 0 .8rem;
    color: #fff;
    font-size: clamp(2.35rem, 7vw, 4.75rem);
    font-weight: 800;
    letter-spacing: -.04em;
}

.zahar-hero .lead { max-width: 670px; margin: auto; color: rgba(255,255,255,.92); }

.zahar-eyebrow,
.zahar-ai-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.zahar-eyebrow { padding: .5rem .85rem; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.25); }

.zahar-page { background: var(--zahar-surface); color: var(--zahar-ink); }

.zahar-page .container { max-width: 1160px; }

.zahar-disclaimer {
    display: flex;
    gap: .8rem;
    align-items: flex-start;
    margin: -1.55rem 0 1.5rem;
    padding: .95rem 1.1rem;
    color: #72410e;
    background: #fff4dc;
    border: 1px solid #f3d89c;
    border-radius: 14px;
    box-shadow: 0 .4rem 1.3rem rgba(91, 48, 11, .08);
}

.zahar-disclaimer i { margin-top: .15rem; color: #b96a0c; }
.zahar-disclaimer p { margin: 0; font-size: .88rem; }

.zahar-card {
    padding: clamp(1.2rem, 3vw, 1.8rem);
    background: var(--zahar-card);
    border: 1px solid var(--zahar-border);
    border-radius: 20px;
    box-shadow: 0 .75rem 2.2rem rgba(102, 52, 22, .08);
}

.zahar-card--summary { background: linear-gradient(135deg, #fff6e8, #fffefd 62%); }
.zahar-card-kicker { margin: 0 0 .35rem; color: var(--zahar-primary); font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.zahar-profile-label { display: grid; gap: .25rem; color: var(--zahar-muted); font-size: .82rem; font-weight: 700; }
.zahar-profile-label .form-select { min-width: 125px; font-weight: 700; }

.zahar-total-row { display: flex; align-items: baseline; gap: .75rem; margin-top: 1.55rem; }
.zahar-total-row strong { color: var(--zahar-primary-dark); font-size: clamp(2.45rem, 7vw, 4.25rem); letter-spacing: -.06em; line-height: .9; }
.zahar-total-row span { color: var(--zahar-muted); font-weight: 600; }

.zahar-progress { height: 14px; margin: 1rem 0 .65rem; overflow: hidden; background: #f3e1ce; border-radius: 999px; }
.zahar-progress .progress-bar { background: linear-gradient(90deg, #e28a18, var(--zahar-primary)); transition: width .3s ease, background .3s ease; }
.zahar-status { color: var(--zahar-muted); font-weight: 600; }
.zahar-status.is-danger { color: var(--zahar-danger); }
.zahar-total-secondary { margin-top: .75rem; color: var(--zahar-muted); font-size: .84rem; }
.zahar-total-secondary strong { color: var(--zahar-primary-dark); font-size: 1rem; }
.zahar-total-secondary span { font-size: .77rem; }

.zahar-guidelines { padding-left: 1.15rem; color: var(--zahar-muted); }
.zahar-guidelines li + li { margin-top: .55rem; }
.zahar-ai-badge { padding: .4rem .6rem; color: #6d3b96; background: #f4eaff; border: 1px solid #dfc8f6; }

.zahar-camera {
    position: relative;
    display: grid;
    min-height: 235px;
    overflow: hidden;
    background: #35261f;
    border: 2px dashed #d6aa82;
    border-radius: 16px;
    place-items: center;
}

.zahar-camera video,
.zahar-camera img { width: 100%; height: 100%; max-height: 390px; object-fit: contain; }
.zahar-camera img { cursor: crosshair; touch-action: none; }
.zahar-ocr-number-overlay { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.zahar-ocr-number-marker { position: absolute; z-index: 1; padding: .24rem .46rem; color: #fff; font-size: .76rem; font-weight: 800; line-height: 1; white-space: nowrap; pointer-events: auto; background: #0d6efd; border: 2px solid #fff; border-radius: .4rem; box-shadow: 0 .2rem .6rem rgba(0, 54, 138, .55); transform: translateY(-100%); }
.zahar-ocr-number-marker:focus-visible { outline: 3px solid #9ec5fe; outline-offset: 2px; }
.zahar-ocr-selection-box { position: absolute; z-index: 4; pointer-events: none; background: rgba(13, 110, 253, .2); border: 2px dashed #0d6efd; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .24); }
.zahar-drag-hint { color: #3d638f; font-size: .82rem; font-weight: 600; }
.zahar-camera-placeholder { display: grid; gap: .7rem; color: #f8e8da; text-align: center; }
.zahar-camera-placeholder i { font-size: 2.5rem; }
.zahar-camera-placeholder span { font-size: .9rem; }

.zahar-api-details { padding: .85rem 1rem; background: #fffaf4; border: 1px solid var(--zahar-border); border-radius: 12px; }
.zahar-api-details summary { color: var(--zahar-primary-dark); cursor: pointer; font-weight: 700; }
.zahar-api-details[open] summary { margin-bottom: .2rem; }
.zahar-ocr-status { padding: .7rem .85rem; color: var(--zahar-primary-dark); font-size: .86rem; font-weight: 600; background: #fff4dc; border: 1px solid #f3d89c; border-radius: 10px; }
.zahar-ocr-raw { color: var(--zahar-muted); font-size: .8rem; }
.zahar-ocr-raw summary { cursor: pointer; font-weight: 700; }
.zahar-ocr-raw pre { max-height: 145px; margin: .5rem 0 0; padding: .65rem; overflow: auto; color: inherit; white-space: pre-wrap; background: #fffaf4; border: 1px solid var(--zahar-border); border-radius: 8px; }
.zahar-ocr-suggestions { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; padding: .7rem .85rem; color: var(--zahar-muted); font-size: .82rem; background: #fffaf4; border: 1px solid var(--zahar-border); border-radius: 10px; }
.zahar-ocr-suggestions strong { width: 100%; color: var(--zahar-primary-dark); }

.zahar-result { margin-top: 1.35rem; padding: 1.1rem; background: #f8fff9; border: 1px solid #bce1c4; border-radius: 14px; }
.zahar-result dl { font-size: .93rem; }
.zahar-result dt { color: #46604c; font-weight: 700; }
.zahar-result dd { font-weight: 700; }
.zahar-consumption-choice { padding: .75rem .85rem; background: #fff; border: 1px solid #d7e7d9; border-radius: 10px; }
.zahar-consumption-preview { padding: .75rem .85rem; color: #46604c; font-size: .88rem; font-weight: 600; background: #f2faf3; border-radius: 10px; }
.zahar-consumption-preview.is-danger { color: var(--zahar-danger); background: #fff0f0; }

/* Traffic light for the day's added sugar + the long-term health note */
.zahar-status-badge { display: flex; gap: .55rem; align-items: center; margin-top: .8rem; padding: .55rem .8rem; font-size: .86rem; font-weight: 800; border: 1px solid transparent; border-radius: 10px; }
.zahar-status-badge i { font-size: 1rem; }
.zahar-status-badge.is-green { color: #14622f; background: #e6f6ec; border-color: #a9dcbb; }
.zahar-status-badge.is-yellow { color: #7a5a08; background: #fdf3d5; border-color: #edd28a; }
.zahar-status-badge.is-orange { color: #8a3d0b; background: #fdeadb; border-color: #f0b98d; }
.zahar-status-badge.is-red { color: #8a1220; background: #fbe0e3; border-color: #eea3ad; }

.zahar-risk { margin-top: .75rem; padding: .8rem .9rem; font-size: .84rem; border: 1px solid #f0b98d; border-left-width: 4px; border-radius: 10px; background: #fff6f0; color: #6d3a17; }
.zahar-risk.is-red { border-color: #eea3ad; background: #fff0f2; color: #6d1520; }
.zahar-risk strong { display: block; margin-bottom: .4rem; font-size: .9rem; }
.zahar-risk-list { padding-left: 1.15rem; }
.zahar-risk-list li { margin-bottom: .15rem; }
.zahar-risk-note { font-size: .76rem; opacity: .9; }

.zahar-estimate-hint { color: var(--zahar-muted); font-size: .76rem; line-height: 1.35; }
body.dark-theme .zahar-estimate-hint { color: #d8b9a4; }

/* New-day banner: "yesterday just became history" notice, coloured by yesterday's traffic light */
.zahar-newday-banner { display: flex; flex-wrap: wrap; gap: .5rem .7rem; align-items: center; margin-bottom: 1rem; padding: .65rem .85rem; font-size: .86rem; font-weight: 600; border: 1px solid #a9dcbb; border-radius: 10px; background: #e6f6ec; color: #14622f; }
.zahar-newday-banner[hidden] { display: none; }
.zahar-newday-banner i.fa-calendar-day { font-size: 1rem; }
.zahar-newday-banner strong { font-weight: 800; }
.zahar-newday-banner.is-yellow { border-color: #edd28a; background: #fdf3d5; color: #7a5a08; }
.zahar-newday-banner.is-orange { border-color: #f0b98d; background: #fdeadb; color: #8a3d0b; }
.zahar-newday-banner.is-red { border-color: #eea3ad; background: #fbe0e3; color: #8a1220; }
.zahar-newday-cta { margin-left: auto; padding: .28rem .7rem; font-size: .78rem; font-weight: 800; color: inherit; background: rgba(255, 255, 255, .55); border: 1px solid currentColor; border-radius: 999px; cursor: pointer; }
.zahar-newday-cta:hover { background: rgba(255, 255, 255, .85); }
.zahar-newday-close { border: 0; background: transparent; color: inherit; opacity: .65; cursor: pointer; }
.zahar-newday-close:hover { opacity: 1; }

/* History: collapsed day rows, each a self-contained disclosure button */
.zahar-history-item { display: flex; flex-direction: column; }
.zahar-history-header { display: grid; grid-template-columns: auto 1fr auto auto; gap: .6rem; align-items: center; width: 100%; padding: .65rem .75rem; text-align: left; background: #fffaf4; border: 1px solid #f2dec9; border-radius: 12px; cursor: pointer; }
.zahar-history-header:hover { background: #fff3e2; }
.zahar-history-dot { width: .6rem; height: .6rem; border-radius: 50%; background: #6fbf87; }
.zahar-history-dot.is-yellow { background: #e8b93a; }
.zahar-history-dot.is-orange { background: #e8822f; }
.zahar-history-dot.is-red { background: #d9414f; }
.zahar-history-date { font-weight: 700; text-transform: capitalize; }
.zahar-history-total { color: var(--zahar-primary-dark); font-weight: 800; white-space: nowrap; }
.zahar-history-chevron { transition: transform .15s; color: var(--zahar-muted); }
.zahar-history-header.is-open .zahar-history-chevron { transform: rotate(180deg); }
.zahar-history-details { margin-top: .5rem; }
.zahar-history-product { grid-template-columns: 1fr auto; }

.zahar-log { display: grid; gap: .6rem; }
.zahar-log-item { display: grid; grid-template-columns: 1fr auto auto auto; gap: .65rem; align-items: center; padding: .75rem; background: #fffaf4; border: 1px solid #f2dec9; border-radius: 12px; }
.zahar-log-item strong { display: block; font-size: .92rem; }
.zahar-log-item small { color: var(--zahar-muted); }
.zahar-log-sugar { color: var(--zahar-primary-dark); font-weight: 800; white-space: nowrap; }
.zahar-log-empty { padding: 1rem; color: var(--zahar-muted); text-align: center; border: 1px dashed var(--zahar-border); border-radius: 12px; }

/* planned ("Vreau să consum") entries: in the journal, but not counted as intake yet */
.zahar-log-group { margin-top: .35rem; color: var(--zahar-muted); font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.zahar-log-group:first-child { margin-top: 0; }
.zahar-log-item.is-planned { background: #fff8ec; border-style: dashed; border-color: #e8c48c; }
.zahar-log-item.is-planned .zahar-log-sugar { color: #a9762a; }
.zahar-planned-note { margin-top: .5rem; padding: .5rem .7rem; color: #8a5a12; font-size: .82rem; font-weight: 600; background: #fff4dc; border: 1px solid #f3d89c; border-radius: 10px; }
.zahar-planned-note.is-danger { color: var(--zahar-danger); background: #fff0f0; border-color: #f5c2c2; }

.zahar-recent-heading { margin-top: 1.35rem; padding-top: 1.15rem; border-top: 1px solid var(--zahar-border); }
.zahar-recent-open { color: var(--zahar-primary-dark); font-size: .78rem; font-weight: 800; }
.zahar-recent-actions { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; justify-content: flex-end; }
.zahar-recent-editor { display: grid; gap: .5rem; grid-column: 1 / -1; margin-top: .6rem; padding: .7rem; background: #fff4e4; border: 1px solid #f2dec9; border-radius: 10px; }
.zahar-recent-field { display: grid; gap: .2rem; }
.zahar-recent-field span { color: var(--zahar-muted); font-size: .72rem; font-weight: 700; }
.zahar-recent-editor-actions { display: flex; gap: .4rem; }

.zahar-sources { padding: .75rem 1rem; color: var(--zahar-muted); font-size: .82rem; text-align: center; }
.zahar-sources a { color: var(--zahar-primary-dark); font-weight: 700; }

body.dark-theme .zahar-page { background: #17110e; color: #f8e9dc; }
body.dark-theme .zahar-card { background: #241813; border-color: #603a25; box-shadow: none; }
body.dark-theme .zahar-card--summary { background: linear-gradient(135deg, #3c2216, #241813 65%); }
body.dark-theme .zahar-total-row strong, body.dark-theme .zahar-card-kicker, body.dark-theme .zahar-api-details summary { color: #ffb267; }
body.dark-theme .zahar-total-row span, body.dark-theme .zahar-status, body.dark-theme .zahar-guidelines, body.dark-theme .zahar-log-item small, body.dark-theme .zahar-sources { color: #d8b9a4; }
body.dark-theme .zahar-total-secondary { color: #d8b9a4; }
body.dark-theme .zahar-api-details, body.dark-theme .zahar-log-item { background: #1c130f; border-color: #603a25; }
body.dark-theme .zahar-ocr-status { color: #f7d48e; background: #38280e; border-color: #70521d; }
body.dark-theme .zahar-ocr-raw pre { background: #1c130f; border-color: #603a25; }
body.dark-theme .zahar-ocr-suggestions { color: #d8b9a4; background: #1c130f; border-color: #603a25; }
body.dark-theme .zahar-status-badge.is-green { color: #9fe3b6; background: #16301f; border-color: #2f6b45; }
body.dark-theme .zahar-status-badge.is-yellow { color: #f7d48e; background: #38280e; border-color: #70521d; }
body.dark-theme .zahar-status-badge.is-orange { color: #ffbe8f; background: #3a2313; border-color: #7d4a24; }
body.dark-theme .zahar-status-badge.is-red { color: #ffb3bd; background: #3a1620; border-color: #7d2b3a; }
body.dark-theme .zahar-risk { color: #f0cbb2; background: #2a1a10; border-color: #7d4a24; }
body.dark-theme .zahar-risk.is-red { color: #ffc6cd; background: #2c1218; border-color: #7d2b3a; }
body.dark-theme .zahar-recent-heading { border-color: #603a25; }
body.dark-theme .zahar-log-group { color: #c9a288; }
body.dark-theme .zahar-log-item.is-planned { background: #241a10; border-color: #7a5a2a; }
body.dark-theme .zahar-log-item.is-planned .zahar-log-sugar { color: #f0b866; }
body.dark-theme .zahar-planned-note { color: #f7d48e; background: #38280e; border-color: #70521d; }
body.dark-theme .zahar-planned-note.is-danger { color: #ffb3b3; background: #3a1717; border-color: #7a3030; }
body.dark-theme .zahar-recent-editor { background: #1c130f; border-color: #603a25; }
body.dark-theme .zahar-newday-banner { color: #9fe3b6; background: #16301f; border-color: #2f6b45; }
body.dark-theme .zahar-newday-banner.is-yellow { color: #f7d48e; background: #38280e; border-color: #70521d; }
body.dark-theme .zahar-newday-banner.is-orange { color: #ffbe8f; background: #3a2313; border-color: #7d4a24; }
body.dark-theme .zahar-newday-banner.is-red { color: #ffb3bd; background: #3a1620; border-color: #7d2b3a; }
body.dark-theme .zahar-newday-cta { background: rgba(255, 255, 255, .08); }
body.dark-theme .zahar-newday-cta:hover { background: rgba(255, 255, 255, .16); }
body.dark-theme .zahar-history-header { background: #1c130f; border-color: #603a25; }
body.dark-theme .zahar-history-header:hover { background: #241a10; }
body.dark-theme .zahar-history-date { color: #f8e9dc; }
body.dark-theme .zahar-history-dot { background: #4caf6d; }
body.dark-theme .zahar-history-dot.is-yellow { background: #d9ac3a; }
body.dark-theme .zahar-history-dot.is-orange { background: #d9722a; }
body.dark-theme .zahar-history-dot.is-red { background: #c9414f; }
body.dark-theme .zahar-recent-field span { color: #d8b9a4; }
body.dark-theme .zahar-result { background: #152318; border-color: #3c7850; }
body.dark-theme .zahar-result dt { color: #b9d7bd; }
body.dark-theme .zahar-consumption-choice { background: #1c291f; border-color: #3c7850; }
body.dark-theme .zahar-consumption-preview { color: #b9d7bd; background: #1c291f; }
body.dark-theme .zahar-disclaimer { color: #f7d48e; background: #38280e; border-color: #70521d; }

@media (max-width: 575.98px) {
    .zahar-hero { padding-top: 6.75rem; padding-bottom: 3rem; }
    .zahar-disclaimer { margin-top: -1rem; }
    .zahar-card { border-radius: 16px; }
    .zahar-camera { min-height: 205px; }
    .zahar-log-item { grid-template-columns: 1fr auto; }
    .zahar-log-item .btn { grid-column: 1 / -1; }
}
