/* Nutrition -- self-served CSS, no external resources, no web fonts
   (PROJEKT.md 4, 10.2). Mobile first.
   Structure: 1 tokens, 2 base, 3 layout (header, tab bar, footer),
   4 components (buttons, cards, forms, lists, badges, segmented control),
   then page-specific blocks. */

/* ---------- 1. Tokens ---------- */
:root {
    --bg: #f4f6f4;
    --surface: #ffffff;
    --surface-2: #f8faf8;
    --ink: #1c2421;
    --ink-soft: #5c6863;
    --ink-faint: #8b9590;
    --line: #e2e7e4;
    --line-strong: #cdd5d1;
    --accent: #2f6f4f;
    --accent-strong: #245a40;
    --accent-soft: #e7f1eb;
    --danger: #b3261e;
    --danger-soft: #fbeceb;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 20, 0.05), 0 2px 8px rgba(16, 24, 20, 0.04);
    --header-h: 56px;
    --tabbar-h: 52px;
    --content-w: 46rem;
    /* Auswertung: Verhältnis zur Referenz (keine diagnostische Wertung). */
    --bar-rail: #e9ece9;      /* Schiene (Hintergrund des Balkens) */
    --bar-reached: #2f6f4f;   /* grün: Referenzwert erreicht */
    --bar-below: #c8862a;     /* bernstein: unter dem Referenzwert */
    --bar-ul: #c0392b;        /* rot: über der tolerierbaren Höchstmenge */
    --bar-ul-tint: rgba(192, 57, 43, 0.07);
    --bar-share: #5b7a99;     /* neutral: Anteil eines Lebensmittels, Richtwert */
    --bar-over-max: #d9701f;  /* orange: über einem Orientierungswert (höchstens) */
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    font-size: 0.9375rem;
    line-height: 1.45;
    color: var(--ink);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
h1 { font-size: 1.35rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; margin-top: 1.25rem; }
h3 { font-size: 0.95rem; font-weight: 650; margin-top: 1rem; }
p { margin: 0.5rem 0; }
a { color: var(--accent); }
a:hover { color: var(--accent-strong); }
.icon { flex: none; display: block; }
.muted { color: var(--ink-soft); font-size: 0.875rem; }
.hint { color: var(--ink-soft); font-size: 0.875rem; margin: 0.75rem 0; }
.ack { color: var(--accent); font-size: 0.875rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- 3. Layout ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(1.4) blur(8px);
    border-bottom: 1px solid var(--line);
}
.site-header-inner {
    max-width: 72rem;
    margin: 0 auto;
    height: var(--header-h);
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}
.site-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 750;
    font-size: 1.05rem;
    color: var(--ink);
    text-decoration: none;
    letter-spacing: -0.01em;
}
.site-logo {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background:
        radial-gradient(circle at 70% 30%, #8fd1a8 0 22%, transparent 23%),
        linear-gradient(135deg, var(--accent) 0%, #3f8f67 100%);
}
.site-nav { display: none; }
.site-nav a {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius-sm);
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}
.site-nav a:hover { color: var(--ink); background: var(--surface-2); }
.site-nav a.active { color: var(--accent); background: var(--accent-soft); }
.site-nav-guest { display: flex; margin-left: auto; align-items: center; gap: 0.5rem; }
.site-nav a.btn-primary, .site-nav a.btn-primary:hover { color: #fff; background: var(--accent); }
.site-nav a.btn-primary:hover { background: var(--accent-strong); }
.site-user { display: none; margin-left: auto; align-items: center; gap: 0.25rem; }
.icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 0;
    background: none;
    color: var(--ink-soft);
    cursor: pointer;
}
.icon-link:hover, .icon-link.active { color: var(--accent); background: var(--accent-soft); }
.logout-form { display: inline; margin: 0; }

main {
    flex: 1;
    width: 100%;
    max-width: var(--content-w);
    margin: 0 auto;
    padding: 1rem 1rem 1.5rem;
}
main.wide { max-width: 72rem; }

/* Phones: tab bar right below the title row (part of the sticky header);
   desktop: navigation inside the title row. Pages with the "compact-head" body
   class (search, adding an entry) hide the title row on phones. */
.tabbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: var(--tabbar-h);
    border-top: 1px solid var(--line);
}
.tabbar a {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--ink-faint);
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 500;
}
.tabbar a .icon { width: 21px; height: 21px; }
.tabbar a.active { color: var(--accent); }
.tabbar a.active::after {
    content: "";
    position: absolute;
    left: 22%;
    right: 22%;
    bottom: 0;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: var(--accent);
}
@media (max-width: 759px) {
    body.compact-head .site-header-inner { display: none; }
    body.compact-head .tabbar { border-top: 0; }
}

.site-footer {
    width: 100%;
    max-width: var(--content-w);
    margin: 0 auto;
    padding: 0.75rem 1rem 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    font-size: 0.78rem;
}
.site-footer a { color: var(--ink-faint); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

@media (min-width: 760px) {
    .site-nav { display: flex; gap: 0.15rem; }
    .site-user { display: flex; }
    .tabbar { display: none; }
    main { padding: 1.5rem 1.25rem 2rem; }
}

/* ---------- 4. Components ---------- */
.messages { margin: 0 0 0.75rem; }
.message {
    margin: 0 0 0.4rem;
    padding: 0.55rem 0.8rem;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 0.875rem;
}
.message-error, .message-warning { background: var(--danger-soft); color: var(--danger); }

.page-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    margin-bottom: 0.75rem;
}
.page-head h1 { margin: 0; }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.85rem 1rem;
    margin: 0 0 0.75rem;
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card > h2 { font-size: 0.95rem; margin: 0 0 0.4rem; }
.card-list { padding: 0.25rem 0; }

/* Buttons */
button, .btn {
    font: inherit;
}
.btn,
.stacked-form button[type=submit],
.period-form button[type=submit] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 40px;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    background: var(--accent);
    color: #fff;
    transition: background 0.15s, border-color 0.15s;
}
.btn:hover, .stacked-form button[type=submit]:hover, .period-form button[type=submit]:hover {
    background: var(--accent-strong);
    color: #fff;
}
.btn-secondary, .secondary-button {
    background: var(--surface);
    color: var(--accent);
    border: 1px solid var(--line-strong);
}
.btn-secondary:hover, .secondary-button:hover {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-color: var(--accent);
}
.btn-ghost { background: none; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent-strong); }
.btn-sm { min-height: 32px; padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--ink-faint);
    cursor: pointer;
}
.btn-icon:hover { color: var(--danger); background: var(--danger-soft); }
.btn-icon.add:hover { color: var(--accent); background: var(--accent-soft); }
/* Former text-link buttons: quiet, but clearly a button. */
.link-button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: 0;
    border-radius: var(--radius-sm);
    color: var(--ink-soft);
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
    text-decoration: none;
}
.link-button:hover { color: var(--accent); background: var(--accent-soft); }

/* Form controls */
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], select, textarea {
    font: inherit;
    font-size: 1rem; /* >= 16px: no zoom on iOS */
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.65rem;
    min-height: 40px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; }
.stacked-form p { margin: 0 0 0.85rem; }
.stacked-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.25rem;
}
.stacked-form input:not([type=checkbox]):not([type=radio]),
.stacked-form select,
.stacked-form textarea { width: 100%; max-width: 26rem; }
.stacked-form .helptext, .stacked-form small { display: block; color: var(--ink-soft); font-size: 0.8rem; margin-top: 0.2rem; }
.stacked-form button[type=submit] { margin-top: 0.25rem; }
.stacked-form .errorlist, .form-errors {
    color: var(--danger);
    font-size: 0.85rem;
    list-style: none;
    padding: 0;
    margin: 0.25rem 0;
}

/* Lists */
.list-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.7rem 1rem;
    border: 0;
    background: none;
    color: var(--ink);
    text-decoration: none;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.list-row > span { flex: 1; }
.list-row .icon { color: var(--ink-faint); }
.list-row:hover { background: var(--surface-2); color: var(--accent); }
.card-list > * + *, .card-list > form + form, .card-list > a + form { border-top: 1px solid var(--line); }
.account-links { margin-top: 1.5rem; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}
.badge-accent { background: var(--accent-soft); border-color: transparent; color: var(--accent-strong); }

/* Segmented control (e.g. period: Heute / 7 / 14 / 30 Tage) */
.seg {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    border-radius: 10px;
    background: #e8ece9;
}
.seg a, .seg button {
    padding: 0.35rem 0.8rem;
    border-radius: 8px;
    border: 0;
    background: none;
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}
.seg a.current, .seg a[aria-current], .seg button[aria-pressed=true] {
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 1px 2px rgba(16, 24, 20, 0.12);
}

/* Search field */
input.search-input {
    width: 100%;
    font-size: 1rem;
    padding: 0.6rem 0.85rem 0.6rem 2.4rem;
    min-height: 44px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b9590' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m16 16 4.5 4.5'/%3E%3C/svg%3E") no-repeat 0.85rem center / 18px;
}
.htmx-indicator {
    opacity: 0;
    margin-left: 0.5rem;
    color: var(--ink-soft);
    font-size: 0.8rem;
    transition: opacity 0.2s;
}
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* Back link, item header, amount entry */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    margin: 0 0 0.5rem -0.35rem;
    padding: 0.2rem 0.4rem 0.2rem 0.15rem;
    border-radius: var(--radius-sm);
    color: var(--ink-soft);
    font-size: 0.85rem;
    text-decoration: none;
}
.back-link .icon { width: 18px; height: 18px; }
.back-link:hover { color: var(--accent); background: var(--accent-soft); }
.back a { color: var(--ink-soft); font-size: 0.85rem; text-decoration: none; }
.item-head { margin: 0 0 0.75rem; }
.item-head h1 { margin: 0 0 0.35rem; }
.item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin: 0; }
.field-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); margin: 0.25rem 0 0.3rem; }
.amount-card select { width: 100%; margin-bottom: 0.9rem; }
.amount-input { position: relative; display: flex; align-items: center; }
.amount-input input {
    width: 100%;
    font-size: 1.6rem;
    font-weight: 700;
    min-height: 56px;
    padding-right: 3rem;
    font-variant-numeric: tabular-nums;
}
.amount-input .unit { position: absolute; right: 0.9rem; color: var(--ink-soft); font-weight: 600; }
.quick-amounts { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.5rem 0 0.9rem; }
.chip {
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
    font-size: 0.82rem;
    cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.seg-scroll { display: flex; max-width: 100%; overflow-x: auto; margin: 0 0 0.75rem; scrollbar-width: none; }
.seg-scroll::-webkit-scrollbar { display: none; }
.seg-scroll a { flex: 1; text-align: center; }

/* Detail pages */
.btn-block-mobile { margin: 0 0 0.85rem; }
@media (max-width: 759px) { .btn-block-mobile { display: flex; width: 100%; } }
.nutrient-card h2 { font-size: 0.9rem; margin: 0.1rem 0 0.35rem; color: var(--ink-soft); }
.nutrient-card .nutrients tr:last-child th, .nutrient-card .nutrients tr:last-child td { border-bottom: 0; }
.origin-inline { display: none; }
@media (max-width: 600px) {
    .nutrients .origin { display: none; }
    .origin-inline { display: inline; margin-left: 0.3rem; font-size: 0.7rem; font-weight: 400; color: var(--ink-faint); }
    .origin-inline::before { content: "· "; }
}
.estimate-mark-inline { font-style: normal; font-size: 0.72rem; color: var(--ink-faint); }
.badge .icon { width: 13px; height: 13px; }

/* Result lists (search, diary add) */
.hits {
    list-style: none;
    padding: 0;
    margin: 0.25rem 0 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.hits li + li { border-top: 1px solid var(--line); }
.hits a {
    display: block;
    padding: 0.32rem 0.85rem;
    line-height: 1.35;
    color: var(--ink);
    text-decoration: none;
}
.hits a:hover { background: var(--surface-2); color: var(--accent); }
.result-group {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-faint);
    margin: 0.85rem 0 0.3rem;
}

/* --- Detailseite --- */
.back a,
.basis {
    font-size: 0.9rem;
    color: var(--ink-soft);
    text-decoration: none;
}
.nutrient-tier {
    margin: 1.5rem 0;
}
.nutrients {
    width: 100%;
    border-collapse: collapse;
}
.nutrients th,
.nutrients td {
    text-align: left;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--line);
    vertical-align: baseline;
}
.nutrients th {
    font-weight: 400;
}
.nutrients .amount {
    white-space: nowrap;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.nutrients .origin {
    color: var(--ink-soft);
    font-size: 0.8rem;
}
.nutrients .missing {
    color: var(--ink-soft);
}
.nutrients tr.state-missing th {
    color: var(--ink-soft);
}
.source {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--ink-soft);
}

.form-errors {
    color: #a33;
    padding-left: 1rem;
}
.placeholder-note {
    color: #a33;
    font-size: 0.85rem;
}

/* --- Tagebuch --- */
.date-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin: 0 0 0.75rem;
}
.date-bar .btn-icon.nav { color: var(--ink-soft); width: 40px; height: 40px; border: 1px solid var(--line); background: var(--surface); }
.date-bar .btn-icon.nav:hover { color: var(--accent); background: var(--accent-soft); }
.date-pick { flex: 1; text-align: center; margin: 0; }
.date-pick label { position: relative; display: inline-flex; flex-direction: column; align-items: center; cursor: pointer; padding: 0.15rem 0.75rem; border-radius: var(--radius-sm); }
.date-pick label:hover { background: var(--surface); }
.date-title { font-weight: 700; font-size: 1.1rem; line-height: 1.2; }
.date-sub { font-size: 0.8rem; color: var(--ink-soft); }
/* The native date input covers the label invisibly: tapping the date opens the
   calendar on phones and desktops alike. */
.date-pick input[type=date] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    min-height: 0;
    padding: 0;
    border: 0;
}
.date-pick input[type=date]::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.back-today { text-align: center; margin: -0.5rem 0 0.5rem; }

.tiles {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
    margin: 0 0 0.75rem;
}
.tile {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.55rem 0.2rem;
    text-align: center;
    min-width: 0;
}
.tile-value { display: block; font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile-value small { font-size: 0.72rem; font-weight: 600; color: var(--ink-soft); }
.tile-label { display: block; font-size: 0.7rem; letter-spacing: -0.01em; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-main { background: var(--accent); border-color: var(--accent); }
.tile-main .tile-value, .tile-main .tile-value small, .tile-main .tile-label { color: #fff; }
.tile-flag { color: inherit; opacity: 0.75; font-size: 0.7rem; margin-left: 1px; }
.tile-goal { color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.tile-main .tile-goal { color: rgba(255, 255, 255, 0.8); }
.tile-bar { --tile-bar: var(--bar-share); display: block; height: 6px; margin: 0.35rem 0.4rem 0; border-radius: 3px; background: var(--bar-rail); position: relative; }
.tile-bar.status-reached, .tile-bar.status-within { --tile-bar: var(--bar-reached); }
.tile-bar.status-below { --tile-bar: var(--bar-below); }
.tile-bar.status-over-max { --tile-bar: var(--bar-over-max); }
.tile-fill { display: block; height: 100%; border-radius: 3px; background: var(--tile-bar); }
.tile-bar.over .tile-fill { border-radius: 3px 0 0 3px; }
/* Over 100 %: the part beyond the target hatched, a mark at 100 %. */
.tile-excess {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    border-radius: 0 3px 3px 0;
    background: repeating-linear-gradient(-45deg, var(--tile-bar) 0 3px, transparent 3px 5px);
}
.tile-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--ink); }
.tile-over { font-weight: 700; color: var(--ink); }
/* Over 100 %: a light end cap shows the bar goes beyond the target. */
.tile-main .tile-bar { background: rgba(255, 255, 255, 0.3); }
.tile-main .tile-bar { --tile-bar: #fff; }
.tile-main .tile-mark { background: var(--ink); box-shadow: 0 0 0 1px #fff; }
.tile-main .tile-over { color: #fff; }
.goal-of { color: var(--ink-faint); font-size: 0.8rem; }
.day-details .bar-cell { width: 34%; padding-left: 0.5rem; padding-right: 0.5rem; vertical-align: middle; }
.day-details .bar-cell .nb-track { display: block; height: 0.6rem; }
.day-details .pct { width: 1%; white-space: nowrap; text-align: right; font-size: 0.8rem; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) {
    .day-details .bar-cell { width: 26%; padding-left: 0.25rem; padding-right: 0.25rem; }
    .day-details .goal-of { display: block; }
}

.day-details { padding: 0; }
.day-details > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    cursor: pointer;
    list-style: none;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink-soft);
}
.day-details > summary::-webkit-details-marker { display: none; }
.day-details[open] > summary .icon { transform: rotate(180deg); }
.day-details > table, .day-details > .hint { margin: 0 1rem 0.75rem; width: calc(100% - 2rem); }
.day-details .group-row th {
    padding: 0.9rem 0.25rem 0.3rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--ink-soft);
    border-bottom: 1px solid var(--line-strong);
}
.day-details tbody:first-child .group-row th { padding-top: 0.2rem; }

/* All day values at the bottom of the diary (report rows for one day). */
.day-values { margin-top: 1.75rem; }
.day-values-title { font-size: 1.05rem; margin: 0 0 0.5rem; }
.nb-coverage { margin-left: 0.35rem; }
.meal { position: relative; padding: 0.35rem 0.25rem 0.35rem 1rem; }
/* Phone: title with add/copy/save, energy sum on the right, macro sums below;
   per entry only the energy. PC (min-width 760px, below): four columns. */
.meal-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 0.5rem;
    min-height: 38px;
}
.meal-title { display: flex; align-items: center; gap: 0.1rem; min-width: 0; }
.meal-title h2 { margin: 0 0.4rem 0 0; font-size: 0.95rem; }
.meal-sums { display: contents; }
.meal-sums .val-enercc {
    grid-column: 2;
    grid-row: 1;
    padding-right: 0.5rem;
    font-size: 0.82rem;
    color: var(--ink-soft);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.meal-sums .val-enercc .val-label { display: none; }
.meal-macros {
    grid-column: 1 / -1;
    grid-row: 2;
    padding-bottom: 0.3rem;
    font-size: 0.78rem;
    color: var(--ink-soft);
    font-variant-numeric: tabular-nums;
}
.meal-macros .val + .val::before { content: " · "; }
.val-spacer { display: none; }
.meal-title .meal-menu { position: static; }
.meal-title .menu-pop { left: 0.5rem; right: auto; top: 2.6rem; width: min(22rem, calc(100% - 1rem)); }
.meal-empty { display: block; padding: 0.1rem 0 0.5rem; font-size: 0.85rem; color: var(--ink-faint); text-decoration: none; }
.meal-empty:hover { color: var(--accent); }

.entries { list-style: none; padding: 0; margin: 0; }
.entries li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.1rem 0;
    border-top: 1px solid var(--line);
}
.entries .btn-icon { width: 30px; height: 30px; }
.entry-name { flex: 1; min-width: 0; line-height: 1.3; overflow-wrap: anywhere; }
.entry-amount { color: var(--ink-soft); font-size: 0.85rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.entry-vals .val { display: none; font-size: 0.85rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.entry-vals .val-enercc { display: inline-block; min-width: 4.2rem; text-align: right; }
@media (min-width: 760px) {
    .meal-head { display: flex; gap: 0.6rem; }
    .meal-title { flex: 1; }
    .meal-sums { display: flex; align-items: flex-end; gap: 0.6rem; }
    .meal-macros { display: contents; }
    .meal-sums .val {
        display: flex;
        flex-direction: column-reverse;
        align-items: flex-end;
        width: 4.75rem;
        padding: 0;
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--ink);
    }
    .meal-sums .val-label,
    .meal-sums .val-enercc .val-label { display: block; font-size: 0.68rem; font-weight: 400; color: var(--ink-faint); }
    .meal-macros .val + .val::before { content: none; }
    .val-spacer { display: block; flex: none; width: 30px; }
    .entry-vals { display: flex; gap: 0.6rem; }
    .entry-vals .val { display: block; width: 4.75rem; text-align: right; color: var(--ink-soft); }
    .entry-vals .val-enercc { min-width: 0; color: var(--ink); }
}
.inline-form { display: inline; margin: 0; }
.card .entries li:first-child, .card > .entries:first-child li:first-child { border-top: 0; }
.add-link { color: var(--accent); text-decoration: none; font-size: 0.875rem; }
.complete-form { margin: 1rem 0 0; text-align: center; }
.complete-form .is-complete { color: var(--accent-strong); background: var(--accent-soft); border-color: transparent; }
.complete-form .muted { font-size: 0.78rem; margin-top: 0.4rem; }

.nutrients.compact th, .nutrients.compact td { padding: 0.3rem 0.25rem; font-size: 0.875rem; }
.nutrients .coverage { width: 1%; white-space: nowrap; }

/* Narrow phones: energy as a wide tile, the three macros below it. */
@media (max-width: 520px) {
    .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tile-main { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 0 0.5rem; padding: 0.5rem; }
    .tile-main .tile-bar { flex-basis: 100%; margin: 0.35rem 0.5rem 0; }
    .tile-main .tile-value { font-size: 1.25rem; }
    .tile-main .tile-label { font-size: 0.8rem; }
}
@media (max-width: 420px) {
    .tile-value { font-size: 1rem; }
    .entry-amount { font-size: 0.8rem; }
    .entry-vals .val-enercc { min-width: 3.6rem; font-size: 0.8rem; }
}

/* --- Mahlzeiten: Menü, Kopieren, Vorlagen, Schnellauswahl --- */
.meal-menu { position: relative; }
.meal-menu > summary { list-style: none; }
.meal-menu > summary::-webkit-details-marker { display: none; }
.meal-menu[open] > summary { color: var(--accent); background: var(--accent-soft); }
.menu-pop {
    position: absolute;
    right: 0;
    top: 2.4rem;
    z-index: 10;
    width: min(20rem, calc(100vw - 2rem));
    padding: 0.35rem 0;
    box-shadow: 0 6px 24px rgba(16, 24, 20, 0.16);
}
.menu-pop .list-row { padding: 0.55rem 0.9rem; font-size: 0.9rem; }
.menu-pop .list-row.danger { color: var(--danger); }
.menu-pop .list-row.danger .icon { color: var(--danger); }
.menu-form { padding: 0.5rem 0.9rem 0.6rem; border-top: 1px solid var(--line); margin: 0; }
.menu-form .field-label { display: flex; align-items: center; gap: 0.35rem; }
.menu-form .field-label .icon { width: 16px; height: 16px; }
.menu-inline { display: flex; gap: 0.4rem; }
.menu-inline input { flex: 1; min-width: 0; min-height: 34px; padding: 0.3rem 0.5rem; font-size: 0.95rem; }
.quick-list { padding: 0; }
.quick-row, .template-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 0.85rem; margin: 0; }
.quick-list > .quick-row + .quick-row, .card-list > .template-row + .template-row { border-top: 1px solid var(--line); }
.quick-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.quick-text small { color: var(--ink-soft); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.quick-row .btn .icon { width: 16px; height: 16px; }
.result-group .icon { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: 0.15rem; }
.templates-section { margin-top: 1.75rem; }
.templates-section h2 { margin: 0; }

/* --- Rezepte --- */
.action-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0 0 0.85rem; }
.empty-state { text-align: center; padding: 1.5rem 1rem; }
.list-row small { flex: none; }
.ingredient-amount-form { display: flex; align-items: center; gap: 0.25rem; margin: 0; }
.ingredient-amount-form input[name=amount_g] { width: 4.8rem; min-height: 34px; padding: 0.25rem 0.4rem; text-align: right; font-size: 0.95rem; }
.ingredient-amount-form .unit { color: var(--ink-soft); font-size: 0.85rem; }
.coverage-inline { display: block; font-weight: 400; color: var(--ink-faint); font-size: 0.72rem; }
.stacked-form button.btn-block { width: 100%; }
#ingredient-results { margin-top: 0.5rem; }

/* --- Rezepte (ab Schritt 6b) --- */
.recipe-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: baseline;
    margin: 1rem 0;
}
.recipe-actions a {
    color: var(--accent);
    text-decoration: none;
}
.ingredient-results {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
}
.ingredient-add-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--line);
}
.ingredient-add-row .entry-name {
    flex: 1;
}
.ingredient-add-row input[name=amount_g] {
    width: 4.5rem;
    padding: 0.3rem;
    border: 1px solid var(--line);
    border-radius: 4px;
}

/* --- Auswertung (ab Schritt 7b) --- neutral, keine Warnfarben (PROJEKT.md 8.6) */
.report-period {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: baseline;
    margin: 0.5rem 0;
    font-size: 0.9rem;
}
.report-period a {
    color: var(--ink-soft);
    text-decoration: none;
}
.report-period a.current {
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
}
.day-nav {
    justify-content: space-between;
    max-width: 32rem;
}
.day-nav strong { color: var(--ink); }
.report-table th[scope=row] {
    font-weight: 400;
}
.nutrient-note {
    display: block;
    font-size: 0.78rem;
    color: var(--ink-soft);
    margin-top: 0.15rem;
}
.comparison {
    font-size: 0.85rem;
}
.percent {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.ref-source,
.soft-note,
.ul-note {
    display: block;
    font-size: 0.78rem;
    color: var(--ink-soft);
    margin-top: 0.15rem;
}
.reference-explainer {
    border-left: 3px solid var(--line);
    padding: 0.25rem 0 0.25rem 1rem;
    margin: 1.5rem 0;
    font-size: 0.85rem;
    color: var(--ink-soft);
}

/* --- Auswertung: Kopf --- */
.report-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin: 0 0 0.75rem; }
.period-custom { position: relative; }
.period-custom > summary { list-style: none; }
.period-custom > summary::-webkit-details-marker { display: none; }
.period-custom .icon { width: 18px; height: 18px; }
.period-custom[open] .period-form { position: absolute; right: 0; top: 2.4rem; z-index: 5; width: max-content; max-width: calc(100vw - 2rem); }
.period-form { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: end; font-size: 0.85rem; }
.period-form label { display: flex; flex-direction: column; gap: 0.2rem; font-weight: 600; color: var(--ink-soft); }
.report-note { font-size: 0.8rem; color: var(--ink-soft); margin: -0.25rem 0 0.75rem; text-align: center; }
.period-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin: 0 0 0.75rem; font-size: 0.85rem; color: var(--ink-soft); }
.seg-sm a { padding: 0.25rem 0.6rem; font-size: 0.78rem; }
.btn-icon.is-disabled { opacity: 0.35; cursor: default; }
.report-group { padding: 0.5rem 0.75rem 0.25rem; }
.report-group .report-group-title { margin: 0.2rem 0.25rem 0.35rem; border: 0; padding: 0; font-size: 0.9rem; }
.report-group .nb:last-child { border-bottom: 0; }
.nb.no-cmp > summary { grid-template-columns: 1fr auto; }
.nb.no-data .nb-name,
.nb.no-data .nb-amount { color: var(--ink-faint); }
.nb.no-data .nb-amount small { font-size: 0.8em; }
.nutrients tr.no-data th,
.nutrients tr.no-data td { color: var(--ink-faint); }
.nutrients tr.no-data small { font-size: 0.8em; }
div.date-pick { display: flex; flex-direction: column; align-items: center; }

/* --- Auswertung: kompakte Balkenansicht --- */
.report-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.9rem;
    list-style: none;
    margin: 0 0 0.6rem;
    padding: 0;
    font-size: 0.8rem;
    color: var(--ink-soft);
}
.report-legend .swatch {
    display: inline-block;
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 2px;
    margin-right: 0.3rem;
    vertical-align: -1px;
}
.report-legend .status-reached { background: var(--bar-reached); }
.report-legend .status-below { background: var(--bar-below); }
.report-legend .status-ul { background: var(--bar-ul); }
.report-legend .status-neutral { background: var(--bar-share); }
.report-legend .status-over-max { background: var(--bar-over-max); }
.report-legend .swatch-ref {
    display: inline-block;
    width: 2px;
    height: 0.95rem;
    background: #4a4a4a;
    margin: 0 0.45rem 0 0.4rem;
    vertical-align: -2px;
}

.report-group-title {
    font-size: 0.95rem;
    color: var(--ink-soft);
    margin: 1.25rem 0 0.25rem;
    border-bottom: 1px solid var(--line);
    padding-bottom: 0.2rem;
}
.nutrient-bars { margin: 0 0 0.5rem; }

.nb { border-bottom: 1px solid var(--line); }
.nb.over-ul { background: var(--bar-ul-tint); }
.nb > summary {
    display: grid;
    /* Feste Spalten, damit die Balken (und die 100%-Marke) zeilenuebergreifend
       exakt fluchten. */
    grid-template-columns: 9.5rem 1fr 11rem;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.4rem;
    cursor: pointer;
    list-style: none;
}
.nb > summary::-webkit-details-marker { display: none; }
.nb > summary::marker { content: ""; }
.nb-name { font-size: 0.9rem; display: flex; align-items: center; gap: 0.3rem; }
/* Chevron: shows that the row can be expanded; turns up when open. */
.nb-chev { flex: none; display: inline-flex; color: var(--ink-soft); transition: transform 0.15s ease; }
.nb-chev .icon { width: 16px; height: 16px; }
.nb[open] .nb-chev { transform: rotate(180deg); color: var(--accent); }
.nb > summary:hover .nb-chev { color: var(--accent); }

/* Balken: Achse 0–150 %, 100 %-Marke bei 2/3 (= 66.666 %). Werte ueber 100 %
   ragen sichtbar ueber die Marke hinaus (gedeckelt bei 150 %). */
.nb-track {
    position: relative;
    height: 0.8rem;
    border-radius: 5px;
    background: var(--bar-rail);
}
.nb-track.status-none { background: transparent; }
.nb-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    min-width: 3px;
    border-radius: 5px;
}
.status-below .nb-fill { background: var(--bar-below); }
.status-reached .nb-fill, .status-within .nb-fill { background: var(--bar-reached); }
.status-neutral .nb-fill { background: var(--bar-share); }
.status-over-max .nb-fill { background: var(--bar-over-max); }
.nb.over-ul .nb-fill { background: var(--bar-ul); }
.nb-ref {
    position: absolute;
    left: 50%;
    top: -3px;
    bottom: -3px;
    width: 2px;
    margin-left: -1px;
    background: #3a3a3a;
    border-radius: 1px;
}
/* ueber 200 %: Balken ist gedeckelt; gerade (abgeschnittene) Kante + »-Hinweis,
   dass die Zufuhr noch darueber hinausgeht. */
.nb-track.over-axis .nb-fill {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.nb-more {
    position: absolute;
    right: 3px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.95);
    font-weight: 700;
    font-size: 0.8rem;
    line-height: 1;
    pointer-events: none;
}

.nb-value {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.1rem;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.nb-value-main { display: flex; align-items: baseline; gap: 0.5rem; }
.nb-pct { font-weight: 600; min-width: 3.4rem; text-align: right; }
.nb-amount { color: var(--ink-soft); min-width: 4.6rem; text-align: right; }
.nb-goal { color: var(--ink-faint); }
.nb-detail .ref-source { overflow-wrap: anywhere; }
.nb-ul-badge {
    color: var(--bar-ul);
    font-weight: 700;
    font-size: 0.72rem;
}
.nb-detail {
    font-size: 0.82rem;
    color: var(--ink-soft);
    padding: 0 0.4rem 0.6rem;
}
.nb-detail p { margin: 0.25rem 0; }
/* "Woher kommt es?" -- Anteile der Lebensmittel an einem Naehrstoff. Neutrale
   Farbe: ein Anteil ist weder gut noch schlecht. */
.nb-contrib { margin: 0.2rem 0 0.6rem; }
.nb-contrib-title { font-weight: 600; color: var(--ink); margin: 0.25rem 0 0.3rem; }
.nb-contrib ul { list-style: none; margin: 0; padding: 0; }
.nb-contrib li {
    display: grid;
    grid-template-columns: minmax(0, 11rem) 1fr 8.5rem;
    align-items: center;
    gap: 0.6rem;
    padding: 0.15rem 0;
}
.nb-contrib li.is-rest .c-name { font-style: italic; }
.c-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.c-track {
    position: relative;
    height: 0.55rem;
    border-radius: 4px;
    background: var(--bar-rail);
}
.c-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    border-radius: 4px;
    background: var(--bar-share);
}
.c-val { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.estimate-mark-inline { font-style: italic; color: var(--ink-soft); font-size: 0.75rem; }
.nb-info {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.2rem 0.75rem;
    margin: 0.45rem 0;
}
.nb-info dt { font-weight: 600; color: var(--ink); }
.nb-info dd { margin: 0; }
.report-tip {
    font-size: 0.8rem;
    color: var(--ink-soft);
    margin: 0 0 0.5rem;
}

@media (max-width: 30rem) {
    .nb > summary {
        /* phone: name and values in one line, the bar full width below */
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "name value" "track track";
        gap: 0.3rem 0.5rem;
    }
    .nb > summary .nb-name { grid-area: name; }
    .nb > summary .nb-value { grid-area: value; }
    .nb > summary .nb-track { grid-area: track; margin-left: 1.3rem; }
    .nb-value { font-size: 0.8rem; }
    .nb-value-main { gap: 0.3rem; }
    .nb-pct { min-width: 2.3rem; }
    .nb-amount { min-width: 0; }
    .nb-ul-badge { font-size: 0.68rem; }
    .nb-info { grid-template-columns: 1fr; }
    .nb-info dd { margin-bottom: 0.3rem; }
    .nb-contrib li { grid-template-columns: minmax(0, 7rem) 1fr 6.5rem; gap: 0.4rem; }
}

/* --- Markenprodukte (ab Schritt 8b) --- */
.hits .brand,
.ingredient-results .brand,
.entries .brand {
    color: var(--ink-soft);
    font-size: 0.85rem;
}
.ingredient-add-row.is-unavailable { color: var(--ink-soft); }
.ingredient-add-row .hint-inline {
    font-size: 0.8rem;
    font-style: italic;
    white-space: nowrap;
}
@media (max-width: 600px) {
    .ingredient-add-row.is-unavailable { flex-wrap: wrap; }
    .ingredient-add-row .hint-inline { white-space: normal; }
}
.hits .variant-count {
    color: var(--ink-soft);
    font-size: 0.8rem;
    white-space: nowrap;
}
.variants { margin-top: 1.25rem; }
.variants h2 { font-size: 0.95rem; margin-bottom: 0.2rem; }
.hits .hit-values {
    display: block;
    color: var(--ink-soft);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}
.off-attribution {
    font-size: 0.78rem;
    color: var(--ink-soft);
    margin: 0.75rem 0;
}
.secondary-button.htmx-request { opacity: 0.5; }

/* --- Schaetzungen (ab Schritt 8c) --- neutral gekennzeichnet */
.estimate-mark {
    display: block;
    font-size: 0.78rem;
    color: var(--ink-soft);
    font-style: italic;
}

.legal-text h2 {
    font-size: 1.05rem;
    margin-top: 1.25rem;
}
.legal-text {
    font-size: 0.95rem;
}

/* --- Rezepte: Mengen ändern, Portionen --- */
.amount-unit { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.stacked-form .amount-unit input { min-width: 0; width: 6rem; }
.stacked-form .amount-unit select { min-width: 0; }
.stacked-form textarea {
    width: 100%;
    max-width: 32rem;
    padding: 0.5rem;
    font: inherit;
    border: 1px solid var(--line);
    border-radius: 6px;
}

/* --- Suche: weitere Treffer nachladen --- */
.hits li.more-row { border-bottom: none; text-align: center; }
.more-button {
    background: none;
    border: none;
    color: var(--ink-soft);
    padding: 0.25rem 1.5rem;
    cursor: pointer;
    border-radius: 6px;
    line-height: 0;
}
.more-button:hover,
.more-button:focus-visible { color: var(--accent); background: var(--bar-rail, rgba(0, 0, 0, 0.05)); }
.more-button.htmx-request { opacity: 0.4; }
.ingredient-results li.more-row { text-align: center; }

/* --- Suche: eine gemeinsame Trefferliste (Grundlebensmittel fett, kcal rechts) --- */
.hit { display: flex; align-items: baseline; gap: 0.75rem; }
.hits a.hit { display: flex; }
.hit-main { flex: 1; min-width: 0; }
.hit-food .hit-name { font-weight: 600; }
/* Ingredient rows share the line with amount and button: energy below the name. */
.ingredient-add-row .hit { flex-direction: column; align-items: flex-start; gap: 0.1rem; }
.hit-kcal {
    flex: none;
    color: var(--ink-soft);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* --- Betreiber-Übersicht (dashboard) --- */
main.wide { max-width: 64rem; }
.dash-section { margin: 1.5rem 0 2rem; }
.dash-section h2 { font-size: 1.15rem; margin-bottom: 0.5rem; }
.dash-section h3 { font-size: 1rem; margin: 1rem 0 0.4rem; }
.dash-nav { margin-bottom: 1rem; }
.kpis {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 0.5rem;
    margin: 0;
}
.kpis > div {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0.5rem 0.65rem;
}
.kpis dt { font-size: 0.78rem; color: var(--ink-soft); }
.kpis dd { margin: 0.15rem 0 0; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
.dash-table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
.dash-table th, .dash-table td {
    text-align: left;
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid var(--line);
    vertical-align: baseline;
}
.dash-table th { font-weight: 600; color: var(--ink-soft); font-size: 0.8rem; }
.dash-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dash-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 700px) { .dash-columns { grid-template-columns: 1fr; } }
.warn { color: #a33; }
.inline-check { display: inline-flex; gap: 0.3rem; align-items: center; }
.day-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 6rem;
    border-bottom: 1px solid var(--line);
}
.day-bar { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.day-bar-fill { display: block; width: 100%; background: var(--bar-reached); border-radius: 2px 2px 0 0; min-height: 0; }
.day-bars-axis { display: flex; justify-content: space-between; font-size: 0.75rem; margin-top: 0.2rem; }
.todo-list { padding-left: 1.2rem; margin: 0 0 1rem; }
.todo-list li { margin: 0.25rem 0; }
.cov-cell { width: 35%; }
.cov-bar { display: block; height: 0.5rem; background: var(--bar-rail); border-radius: 3px; overflow: hidden; }
.cov-bar > span { display: block; height: 100%; background: var(--bar-reached); }

/* --- Tagesziele --- */
.target-rows { display: flex; flex-direction: column; }
.target-row { display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 0.75rem; align-items: center; padding: 0.45rem 0; border-top: 1px solid var(--line); }
.target-row:first-child { border-top: 0; }
.target-name { font-size: 0.9rem; font-weight: 600; }
.target-name small { display: block; font-weight: 400; font-size: 0.75rem; color: var(--ink-soft); }
.target-input { display: flex; align-items: center; gap: 0.3rem; }
.target-input input { width: 6.5rem; text-align: right; min-height: 36px; padding: 0.3rem 0.5rem; }
.target-input .unit { width: 2.2rem; color: var(--ink-soft); font-size: 0.85rem; }
.target-row.is-manual input { border-color: var(--accent); background: var(--accent-soft); }
.target-row .form-errors { grid-column: 1 / -1; margin: 0; }
.reset-spacer { display: inline-block; width: 34px; }
.own-value { color: var(--accent-strong); font-weight: 600; }
.used-mark { display: inline-block; margin-left: 0.3rem; padding: 0 0.4rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 0.68rem; font-weight: 600; vertical-align: 1px; }
.own-value .estimate-mark-inline { color: var(--accent); }
.sticky-actions { position: sticky; bottom: env(safe-area-inset-bottom); display: flex; align-items: center; gap: 0.75rem; margin: 0 -1rem; padding: 0.6rem 1rem; z-index: 5; background: rgba(244, 246, 244, 0.95); backdrop-filter: blur(6px); border-top: 1px solid var(--line); }
.target-input input::placeholder { color: var(--ink-faint); font-style: italic; }
@media (min-width: 760px) { .sticky-actions { bottom: 0; margin: 0; border-radius: var(--radius) var(--radius) 0 0; } }
.message-warning a { color: inherit; }

/* --- Anmelden, Registrieren, Einwilligung --- */
main.auth { max-width: 30rem; padding-top: 2rem; }
.auth-card { padding: 1.5rem 1.25rem; }
.auth-card h1 { text-align: center; margin-bottom: 0.25rem; }
.auth-brand { display: flex; justify-content: center; margin-bottom: 0.75rem; }
.auth-brand .site-logo { width: 44px; height: 44px; border-radius: 12px; }
.auth-sub { text-align: center; margin: 0 0 1.25rem; }
.auth-card .stacked-form input:not([type=checkbox]), .auth-card .pw-wrap { width: 100%; max-width: none; }
.auth-switch { text-align: center; margin: 1rem 0 0; font-size: 0.875rem; color: var(--ink-soft); }
.consent-text { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.75rem 0.9rem; margin: 0.75rem 0; font-size: 0.85rem; max-height: 16rem; overflow-y: auto; }
.consent-check { display: flex; gap: 0.6rem; align-items: flex-start; margin: 0.75rem 0; font-size: 0.9rem; }
.consent-check input { margin-top: 0.2rem; flex: none; }

/* --- Registrierung --- */
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.signup-consent-title { font-size: 1.05rem; margin-top: 1.5rem; }
.signup-form small { display: block; margin-top: 0.2rem; }

/* --- Passwortfelder: anzeigen/verbergen, Übereinstimmung --- */
.pw-wrap { position: relative; display: inline-block; width: 100%; max-width: 26rem; }
.pw-wrap input { padding-right: 2.6rem; }
.pw-toggle {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.25rem;
    color: var(--ink-soft);
    cursor: pointer;
    line-height: 0;
    border-radius: 4px;
}
.pw-toggle:hover, .pw-toggle:focus-visible { color: var(--accent); }
.pw-toggle[aria-pressed="true"] { color: var(--accent); }
.pw-match { display: block; font-size: 0.85rem; margin-top: 0.25rem; min-height: 1.1em; }
.pw-match.ok { color: var(--accent); }
.pw-match.bad { color: #a33; }
