/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base font size ──────────────────────────────────────── */
html { font-size: 16px; }

/* ── Design tokens — Index palette ──────────────────────── */
:root {
    /* Font families */
    --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
    --sans:  'Hanken Grotesk', system-ui, -apple-system, sans-serif;
    --mono:  'JetBrains Mono', ui-monospace, monospace;

    /* Color palette */
    --paper:       #FAF8F3;   /* app bg, tab bar, button text-on-ink */
    --card:        #FFFFFF;   /* raised surfaces (used sparingly) */
    --ink:         #1A1610;   /* primary text, hero numbers, CTA fill */
    --soft:        #6B6358;   /* secondary text, section labels */
    --faint:       #A69D8E;   /* tertiary text, placeholders, axis labels */
    --line:        #ECE7DC;   /* hairline dividers, borders, gridlines */
    --line2:       #F4F0E8;   /* macro bar tracks */
    --accent:      #C06A2A;   /* amber: progress, active tab, wordmark "e" */
    --accent-tint: #F6EADD;   /* soft amber wash (hovers / badges) */

    /* Legacy aliases — keep all existing class rules working during restyle */
    --parchment:    var(--paper);
    --kraft:        var(--line);
    --cream:        var(--card);
    --brown-dark:   var(--ink);
    --brown-mid:    var(--soft);
    --brown-light:  var(--faint);
    --terracotta:   var(--accent);
    --rust:         var(--ink);
    --burnt-orange: var(--accent);
    --harvest-gold: var(--accent);
    --avocado:      #3FA277;
    --avocado-dark: #2D7A52;
    --dusty-teal:   #3F8A82;

    /* Semantic aliases */
    --color-primary:      var(--accent);
    --color-primary-dark: var(--ink);
    --color-danger:       var(--accent);
    --color-success:      #3FA277;
    --color-bg:           var(--paper);
    --color-card:         var(--card);
    --color-text:         var(--ink);
    --color-muted:        var(--soft);
    --color-border:       var(--line);

    /* Shape & spacing */
    --radius: 14px;
    --space:  20px;
}

body {
    font-family: var(--sans);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--ink);
    background-color: var(--paper);
    min-height: 100dvh;
}

/* ── App shell ───────────────────────────────────────────── */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

/* ── Header ──────────────────────────────────────────────── */
#app-header {
    background: var(--paper);
    padding: calc(6px + env(safe-area-inset-top, 0px)) 26px 18px;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#app-header h1 {
    font-family: var(--serif);
    font-size: 1.5625rem; /* 25px */
    font-weight: 500;
    letter-spacing: 0.03em;
    color: var(--ink);
    cursor: pointer;
    display: inline-block;
    line-height: 1.1;
    flex: 1;
    text-align: center;
    user-select: none;
}
#app-header h1 b { color: var(--accent); font-weight: 500; }
#app-header h1:active { opacity: 0.75; }
@media (hover: hover) {
    #app-header h1:hover { opacity: 0.85; }
}

/* Shared base for both header buttons */
.header-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    text-decoration: none;
    flex-shrink: 0;
    transition: opacity 0.15s;
}
.header-icon-btn:active { opacity: 0.6; }

/* Left — home: plain icon, always accent */
.header-home-btn {
    color: var(--accent);
    border-radius: 0;
    border: none;
}

/* Right — avatar: circle with hairline border, user glyph in soft */
.header-avatar-btn {
    color: var(--soft);
    border-radius: 50%;
    border: 1px solid var(--line);
}
.header-avatar-btn.active { color: var(--ink); border-color: var(--ink); }

#app-main {
    flex: 1;
    padding: var(--space);
    padding-bottom: calc(var(--space) + 80px + env(safe-area-inset-bottom, 0px));
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
}

/* ── Bottom nav ──────────────────────────────────────────── */
#app-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--paper);
    border-top: 1px solid var(--line);
    display: flex;
    z-index: 10;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 4px 26px;
    text-decoration: none;
    color: var(--faint);
    gap: 5px;
    position: relative;
    transition: color 0.15s;
}

.nav-item.active {
    color: var(--ink);
}

.nav-icon {
    width: 21px;
    height: 21px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.nav-icon svg { display: block; }

.nav-label {
    font-family: var(--mono);
    font-size: 0.625rem; /* 10px */
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
    background: var(--cream);
    border-radius: var(--radius);
    padding: 24px var(--space);
    margin-bottom: var(--space);
    border: 1px solid rgba(139,98,64,0.45);
    box-shadow: 0 6px 24px rgba(44,26,14,0.18), 0 1px 4px rgba(44,26,14,0.10), inset 0 1px 0 rgba(255,255,255,0.6);
    position: relative;
    overflow: hidden;
}

.card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(to right, var(--terracotta), var(--harvest-gold));
}

.card h2 {
    font-family: 'Oswald', sans-serif;
    font-size: 1.25rem; /* 20px */
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--brown-dark);
    margin-bottom: 14px;
}

/* Smaller muted label variant — use on sub-sections */
.card h2.label-sm {
    font-size: 0.6875rem; /* 11px */
    letter-spacing: 0.18em;
    color: var(--brown-light);
    margin-bottom: 10px;
}

/* ── Forms ───────────────────────────────────────────────── */
.form-row { margin-bottom: 14px; }

.form-row label {
    display: block;
    font-family: 'Oswald', sans-serif;
    font-size: 0.6875rem; /* 11px */
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--brown-light);
    margin-bottom: 5px;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1.5px solid var(--kraft);
    border-radius: var(--radius);
    font-family: 'Karla', sans-serif;
    font-size: 1rem; /* ≥16px prevents iOS auto-zoom; safe since html base ≥ 16px when --font-scale ≥ 1 */
    color: var(--brown-dark);
    background: var(--cream);
    box-shadow: inset 0 1px 3px rgba(44,26,14,0.08);
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--terracotta);
    box-shadow: inset 0 1px 3px rgba(44,26,14,0.08), 0 0 0 2px rgba(196,82,42,0.15);
}

input::placeholder { color: var(--kraft); }

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238B6240' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-color: var(--parchment);
    padding-right: 36px;
}

textarea { resize: vertical; }

.form-row-inline { display: flex; gap: 12px; }
.form-col        { flex: 1; }
.form-col-small  { flex: 0 0 80px; }

.form-row-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 4px;
}
.form-row-label label { margin-bottom: 0; }

.btn-field-clear {
    background: var(--cream);
    border: 1.5px solid var(--kraft);
    border-radius: var(--radius);
    padding: 0 10px;
    min-height: 44px;
    min-width: 44px;
    font-family: 'Karla', sans-serif;
    font-size: 0.8125rem; /* 13px */
    font-weight: 700;
    color: var(--brown-light);
    cursor: pointer;
    letter-spacing: 0.02em;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-field-clear:hover  { color: var(--terracotta); border-color: var(--terracotta); }
.btn-field-clear:active { background: var(--parchment); }

.macro-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 12px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius);
    font-family: 'Karla', sans-serif;
    font-size: 1rem; /* 16px */
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    min-height: 48px;
    transition: transform 0.1s, box-shadow 0.1s;
    position: relative;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--terracotta);
    color: var(--cream);
    box-shadow: 0 3px 0 var(--rust), 0 4px 10px rgba(44,26,14,0.2);
}
.btn-primary:active {
    box-shadow: 0 1px 0 var(--rust);
}

.btn-secondary {
    background: var(--brown-mid);
    color: var(--cream);
    box-shadow: 0 3px 0 var(--brown-dark), 0 4px 10px rgba(44,26,14,0.2);
}
.btn-secondary:active {
    box-shadow: 0 1px 0 var(--brown-dark);
}

.btn-block    { display: flex; width: 100%; margin-top: 4px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-icon {
    background: var(--cream);
    border: 1.5px solid var(--kraft);
    border-radius: var(--radius);
    padding: 0 14px;
    font-size: 1rem; /* 16px */
    cursor: pointer;
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--brown-mid);
    font-family: 'Oswald', sans-serif;
    font-weight: 500;
    letter-spacing: 0.05em;
    transition: background 0.15s, border-color 0.15s;
}
.btn-icon:active { background: var(--parchment); border-color: var(--brown-light); }

.btn-danger        { background: var(--terracotta); color: var(--cream); box-shadow: 0 3px 0 var(--rust); }
.btn-danger:active { box-shadow: 0 1px 0 var(--rust); }

.btn-delete {
    background: none;
    border: none;
    color: var(--brown-light);
    font-size: 1.25rem; /* 20px */
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}
.btn-delete:active { color: var(--terracotta); background: rgba(196,82,42,0.08); }

/* ── Date navigation ─────────────────────────────────────── */
.date-nav {
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    min-height: 48px;
}

.date-nav .date-display {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.date-nav .date-display input[type="date"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    padding: 0;
    border: none;
    background: none;
    box-shadow: none;
    font-size: 0;
}

#dash-today-row {
    text-align: center;
    margin-bottom: var(--space);
}

.btn-back-today {
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'Oswald', sans-serif;
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--brown-light);
    text-decoration: underline;
    text-underline-offset: 3px;
    padding: 4px 8px;
    transition: color 0.15s;
}
.btn-back-today:active { color: var(--terracotta); }

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}
.section-header h2 { margin-bottom: 0; }

.date-nav-inline {
    display: flex;
    align-items: center;
    gap: 6px;
}
.date-nav-inline input[type="date"] {
    width: auto;
    font-size: 0.875rem; /* 14px */
    padding: 7px 8px;
}

/* ── Dashboard summary ───────────────────────────────────── */
.calorie-total {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 4rem; /* 64px */
    color: var(--terracotta);
    text-align: center;
    line-height: 1;
    margin: 4px 0 12px;
    letter-spacing: 0.02em;
}

.macro-row {
    display: flex;
    justify-content: space-around;
    padding-top: 10px;
    border-top: 1px solid rgba(139,98,64,0.2);
}

.macro {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 0;
}

.macro-val {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.375rem; /* 22px */
    color: var(--brown-dark);
    letter-spacing: 0.02em;
    line-height: 1;
}

.macro-label {
    font-family: 'Oswald', sans-serif;
    font-size: 0.625rem; /* 10px */
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--brown-light);
}

.weight-display {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 3rem; /* 48px */
    color: var(--brown-dark);
    letter-spacing: 0.02em;
    line-height: 1;
    margin-bottom: 4px;
}

/* ── Dashboard hero calorie stat ─────────────────────────── */
.dash-greeting {
    font-family: 'Karla', sans-serif;
    font-size: 1rem;
    color: var(--brown-light);
    text-align: center;
    padding: 10px 0 2px;
}

.hero-stat {
    text-align: center;
    padding-bottom: 14px;
}

.hero-label {
    font-family: 'Oswald', sans-serif;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--brown-light);
    margin-bottom: 4px;
}

.hero-cal-row {
    display: inline-flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 10px;
}

.hero-cal-val {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 5.5rem;
    color: var(--terracotta);
    letter-spacing: 0.02em;
    line-height: 1;
}

.hero-cal-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    padding-bottom: 4px; /* aligns baseline with the bottom of the big number */
}

.hero-cal-unit {
    font-family: 'Oswald', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brown-mid);
    line-height: 1.2;
}

.hero-cal-goal {
    font-family: 'Oswald', sans-serif;
    font-size: 0.6875rem;
    letter-spacing: 0.06em;
    color: var(--brown-light);
    line-height: 1.2;
}

/* ── Dashboard goals grid ────────────────────────────────── */
.dash-goals {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 12px;
    margin-top: 4px;
}

.goal-stat {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0 4px;
    line-height: 1.3;
}

.goal-val {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.5rem; /* 24px */
    color: var(--brown-dark);
    letter-spacing: 0.02em;
    line-height: 1;
}
.goal-unit   { font-size: 0.75rem; color: var(--brown-light); } /* smaller, lighter */
.goal-target {
    font-family: 'Oswald', sans-serif;
    font-size: 0.625rem; /* 10px — quieter */
    letter-spacing: 0.06em;
    color: var(--kraft);
    width: 100%;
}

/* ── Progress bars ───────────────────────────────────────── */
.progress-bar-track {
    background: rgba(44,26,14,0.1);
    border-radius: 2px;
    height: 8px;
    margin-top: 6px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(44,26,14,0.15);
}
.progress-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(to right, var(--terracotta), var(--harvest-gold));
    transition: width 0.4s ease;
}
.progress-bar-fill.over { background: linear-gradient(to right, var(--rust), var(--terracotta)); }

/* Thin 4px variant used inside the stats grid */
.stat-bar { height: 4px; }

/* ── Water tracker ───────────────────────────────────────── */
.water-tracker {
    font-family: 'Oswald', sans-serif;
    font-size: 0.75rem; /* 12px */
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--brown-light);
    text-align: center;
    margin-bottom: var(--space);
}

/* ── Meal groups (dashboard food list) ───────────────────── */
.meal-group {
    margin-bottom: 4px;
}
.meal-group:last-child { margin-bottom: 0; }

.meal-group-header {
    font-family: 'Oswald', sans-serif;
    font-size: 0.625rem; /* 10px */
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--brown-light);
    padding: 10px 0 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.meal-group-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(139,98,64,0.2);
}

/* ── Food entries ────────────────────────────────────────── */
.food-entry {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 10px 8px;
    border-bottom: 1px solid rgba(139,98,64,0.2);
    gap: 8px;
    border-radius: var(--radius);
}
.food-entry:last-child { border-bottom: none; }
.food-entry:nth-child(even) { background: rgba(139,98,64,0.1); }

a.food-entry {
    text-decoration: none;
    color: inherit;
    margin: 0 -8px;
    padding: 10px 8px;
    width: calc(100% + 16px);
}
a.food-entry:active { background: rgba(44,26,14,0.08); }
a.food-entry:nth-child(even) { background: rgba(139,98,64,0.1); }
a.food-entry:nth-child(even):active { background: rgba(44,26,14,0.08); }
@media (hover: hover) {
    a.food-entry:hover { background: rgba(44,26,14,0.06); }
}

.food-entry-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.food-name {
    font-weight: 600;
    color: var(--brown-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.food-meta, .food-macros {
    font-size: 0.8125rem; /* 13px */
    color: var(--brown-light);
}

.food-entry-right {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.food-cal {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.25rem; /* 20px */
    letter-spacing: 0.02em;
    color: var(--brown-dark);
    min-width: 48px;
    text-align: right;
    line-height: 1;
}

.list-total {
    font-family: 'Oswald', sans-serif;
    font-size: 0.6875rem; /* 11px */
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--brown-light);
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(139,98,64,0.2);
}

/* ── Meal type badges ────────────────────────────────────── */
.meal-badge {
    display: inline-block;
    font-family: 'Oswald', sans-serif;
    font-size: 0.5625rem; /* 9px */
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 2px;
    margin-bottom: 4px;
}
.meal-badge-breakfast { background: rgba(196,82,42,0.12); color: var(--terracotta); }
.meal-badge-lunch     { background: rgba(212,160,23,0.12); color: #9B7800; }
.meal-badge-dinner    { background: rgba(107,122,58,0.12); color: var(--avocado-dark); }
.meal-badge-snack     { background: rgba(74,122,114,0.12); color: var(--dusty-teal); }

/* ── Weight entries ──────────────────────────────────────── */
.weight-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 8px;
    border-bottom: 1px solid rgba(139,98,64,0.2);
    gap: 8px;
    border-radius: var(--radius);
    margin: 0 -8px;
}
.weight-entry:last-child { border-bottom: none; }
.weight-entry:nth-child(even) { background: rgba(139,98,64,0.1); }

.weight-entry-info { display: flex; flex-direction: column; gap: 2px; }

.weight-val {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.5rem; /* 24px */
    color: var(--brown-dark);
    letter-spacing: 0.02em;
    line-height: 1;
}
.weight-date  { font-size: 0.8125rem; color: var(--brown-light); } /* 13px */
.weight-notes { font-size: 0.8125rem; color: var(--brown-light); } /* 13px */

/* ── Utility ─────────────────────────────────────────────── */
.text-muted {
    font-family: 'Oswald', sans-serif;
    font-size: 0.75rem; /* 12px */
    letter-spacing: 0.08em;
    color: var(--brown-light);
}
.loading {
    font-family: 'Oswald', sans-serif;
    font-size: 0.8125rem; /* 13px */
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--brown-light);
    text-align: center;
    padding: 28px;
}
.error       { color: var(--terracotta); font-size: 0.875rem; padding: 8px 0; } /* 14px */
.success-msg { color: var(--avocado);    font-size: 0.875rem; padding: 8px 0; } /* 14px */

/* ── Toast notifications ─────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 88px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
    pointer-events: none;
    width: calc(100% - 32px);
    max-width: 400px;
}

.toast {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-family: 'Karla', sans-serif;
    font-size: 0.875rem; /* 14px */
    font-weight: 600;
    text-align: center;
    animation: toast-in .2s ease;
    pointer-events: auto;
    border-left: 4px solid transparent;
}

.toast-success { background: var(--brown-dark); color: var(--cream); border-left-color: var(--harvest-gold); }
.toast-error   { background: var(--brown-dark); color: var(--cream); border-left-color: var(--terracotta); }
.toast-info    { background: var(--brown-dark); color: var(--cream); border-left-color: var(--dusty-teal); }
.toast-fade-out { opacity: 0; transition: opacity .3s; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Autocomplete dropdown ───────────────────────────────── */
.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--cream);
    border: 1.5px solid var(--kraft);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 6px 20px rgba(44,26,14,0.18);
    z-index: 50;
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 280px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.autocomplete-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 12px;
    min-height: 52px;
    cursor: pointer;
    border-bottom: 1px solid rgba(139,98,64,0.15);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:active { background: var(--parchment); }

.ac-icon    { font-size: 0.875rem; flex-shrink: 0; line-height: 1; } /* 14px */
.ac-content { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.ac-name    { font-weight: 600; font-size: 0.9375rem; color: var(--brown-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* 15px */
.ac-brand   { font-size: 0.75rem; color: var(--brown-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* 12px */
.ac-meta    { font-size: 0.8125rem; color: var(--brown-light); } /* 13px */

.ac-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px 12px;
    min-height: 36px;
    list-style: none;
}
.ac-footer.ac-end {
    font-family: 'Oswald', sans-serif;
    font-size: 0.6875rem; /* 11px */
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--brown-light);
}

.ac-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(139,98,64,0.25);
    border-top-color: var(--terracotta);
    border-radius: 50%;
    animation: ac-spin 0.7s linear infinite;
}
@keyframes ac-spin { to { transform: rotate(360deg); } }

/* ── Quick-log text buttons ──────────────────────────────── */
.quick-log-row {
    display: flex;
    gap: 8px;
    margin-bottom: var(--space);
}

.btn-quick-text {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 6px;
    border-radius: var(--radius);
    background: var(--terracotta);
    border: 1.5px solid var(--terracotta);
    box-shadow: 0 3px 0 var(--rust), 0 4px 10px rgba(44,26,14,0.15);
    cursor: pointer;
    color: var(--cream);
    font-family: 'Oswald', sans-serif;
    font-size: 0.9375rem; /* 15px */
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    text-align: center;
    transition: background 0.15s, color 0.15s, box-shadow 0.1s, transform 0.1s;
}
.btn-quick-text:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 var(--rust);
}
@media (hover: hover) {
    .btn-quick-text:hover {
        background: var(--cream);
        color: var(--terracotta);
        box-shadow: none;
    }
}

.btn-plus  { line-height: 1; }
.btn-label { line-height: 1.2; }

@media (max-width: 600px) {
    .btn-quick-text {
        flex-direction: column;
        gap: 2px;
        min-height: 90px;
        padding: 12px 4px;
    }
    .btn-plus {
        font-size: 2.8rem;
        font-weight: 300;
    }
    .btn-label {
        font-size: 0.75rem;
    }
}

/* ── Date display (static label + hidden picker) ─────────── */
.date-display {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.date-display-label {
    font-family: 'Oswald', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--brown-dark);
    border-bottom: 1.5px dotted var(--brown-light);
    pointer-events: none; /* input overlay handles clicks */
}

/* ── Form sections (food log) ────────────────────────────── */
.form-section {
    margin-bottom: 8px;
}

.form-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Oswald', sans-serif;
    font-size: 0.75rem; /* 12px */
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--brown-light);
    padding: 14px 0 10px;
    border-bottom: 1px solid rgba(139,98,64,0.2);
    margin-bottom: 14px;
}

.form-section-title::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 13px;
    background: var(--terracotta);
    border-radius: 2px;
    flex-shrink: 0;
}

/* ── Food name + scan button row ─────────────────────────── */
.input-with-scan { display: flex; gap: 8px; }
.input-with-scan input { flex: 1; }

/* ── MiniChart ───────────────────────────────────────────── */
.chart-range-row {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.chart-range-btn {
    padding: 4px 12px;
    border: 1.5px solid var(--kraft);
    border-radius: 20px;
    background: transparent;
    color: var(--brown-light);
    font-family: 'Oswald', sans-serif;
    font-size: 0.75rem; /* 12px */
    font-weight: 500;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.chart-range-btn.active {
    background: var(--terracotta);
    border-color: var(--terracotta);
    color: var(--cream);
}
@media (hover: hover) {
    .chart-range-btn:not(.active):hover {
        border-color: var(--terracotta);
        color: var(--terracotta);
    }
}

.chart-svg-wrap {
    /* slight negative margin so chart bleeds to card edge on narrow screens */
    margin: 0 -4px;
}

.chart-empty {
    text-align: center;
    color: var(--brown-light);
    padding: 20px 0 8px;
    font-size: 0.875rem; /* 14px */
}

/* ── Barcode scanner overlay ─────────────────────────────── */
#scanner-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#scanner-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#scanner-reticle {
    position: relative;
    z-index: 1;
    width: 260px;
    height: 160px;
    border: 2px solid var(--harvest-gold);
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.6);
    border-radius: var(--radius);
    overflow: hidden;
}

#scanner-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--terracotta);
    animation: scanner-scan 2s linear infinite;
}
@keyframes scanner-scan {
    0%   { top: 0; }
    100% { top: 100%; }
}

#scanner-hint {
    position: relative;
    z-index: 1;
    font-family: 'Oswald', sans-serif;
    font-size: 0.8125rem; /* 13px */
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--cream);
    margin-top: 20px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

#scanner-cancel {
    position: relative;
    z-index: 1;
    margin-top: 24px;
}

#scanner-torch {
    position: absolute;
    top: calc(16px + env(safe-area-inset-top, 0px));
    right: 16px;
    z-index: 2;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1.5px solid rgba(245,236,216,0.25);
    background: rgba(0,0,0,0.45);
    color: rgba(245,236,216,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    -webkit-tap-highlight-color: transparent;
}

#scanner-torch.torch-on {
    background: var(--harvest-gold);
    border-color: var(--harvest-gold);
    color: var(--brown-dark);
}

/* ── Dashboard divider ───────────────────────────────────── */
.dash-divider {
    border: none;
    border-top: 1px solid rgba(139,98,64,0.2);
    margin: 10px 0 8px;
}

/* ── Account / profile cards ─────────────────────────────── */
.acct-card { margin-top: 12px; }

.input-readonly {
    background: rgba(44,26,14,0.04);
    color: var(--brown-light);
    cursor: default;
}

/* ── Auth views ──────────────────────────────────────────── */
#app-main.no-nav { padding-bottom: var(--space); }

.auth-card {
    max-width: 420px;
    margin: 24px auto 0;
}

.auth-card h2 {
    font-family: 'Oswald', sans-serif;
    font-size: 1.375rem; /* 22px */
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    text-align: center;
    color: var(--brown-mid);
    margin-bottom: 20px;
}

.auth-links {
    text-align: center;
    margin-top: 16px;
    font-size: 0.875rem; /* 14px */
    color: var(--brown-light);
}

.auth-links a {
    color: var(--terracotta);
    text-decoration: none;
    font-weight: 600;
}

/* ── Desktop adjustments ─────────────────────────────────── */
@media (min-width: 640px) {
    #app-main { padding: 24px; padding-bottom: calc(24px + 80px + env(safe-area-inset-bottom, 0px)); }
}

/* ================================================================
   INDEX — screen styles
   Override the old component rules below; tokens from :root above.
   ================================================================ */

/* ── Layout ──────────────────────────────────────────────── */
#app-main {
    padding: 22px 26px calc(90px + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 640px) {
    #app-main { padding: 28px 36px calc(90px + env(safe-area-inset-bottom, 0px)); }
}

/* ── Cards → flat content sections on paper ──────────────── */
.card {
    background: transparent;
    border-radius: 0;
    padding: 22px 0 0;
    margin-bottom: 0;
    border: none;
    box-shadow: none;
    overflow: visible;
    position: static;
}
.card::after { display: none; }
.card + .card { border-top: 1px solid var(--line); }
.acct-card { margin-top: 0; }

.card h2 {
    font-family: var(--serif);
    font-size: 2.125rem; /* 34px */
    font-weight: 500;
    letter-spacing: -0.015em;
    text-transform: none;
    color: var(--ink);
    margin-bottom: 18px;
}
.card h2.label-sm {
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--soft);
    margin-bottom: 10px;
}

/* ── Dashboard — greeting eyebrow ────────────────────────── */
.dash-greeting {
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--faint);
    text-align: left;
    padding: 0 0 2px;
}

/* ── Dashboard — date navigator ──────────────────────────── */
.date-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0;
    margin: 4px 0 8px;
    min-height: auto;
    grid-template-columns: unset;
}
.date-nav .date-display {
    flex: 1;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    position: relative;
}
.date-display-label {
    font-family: var(--serif);
    font-size: 1.875rem; /* 30px */
    font-weight: 500;
    color: var(--ink);
    border-bottom: none;
    letter-spacing: 0;
    text-transform: none;
    pointer-events: none;
    line-height: 1.1;
}
.date-nav .btn-icon {
    width: 34px;
    height: 34px;
    min-height: 34px;
    min-width: 34px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: transparent;
    box-shadow: none;
    color: var(--soft);
    font-family: var(--sans);
    font-weight: 400;
    font-size: 15px;
    letter-spacing: 0;
    padding: 0;
}
.date-nav .btn-icon:active { background: var(--line2); }

#dash-today-row {
    text-align: center;
    margin-bottom: 14px;
    margin-top: 0;
}
.btn-back-today {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--faint);
    text-decoration: none;
    background: none;
    border: none;
    padding: 2px 4px;
}
.btn-back-today:active { color: var(--accent); }

/* ── Dashboard — hairline dividers ───────────────────────── */
.dash-divider {
    border: none;
    border-top: 1px solid var(--line);
    margin: 18px 0;
}

/* ── Dashboard — hero calorie block ──────────────────────── */
.hero-stat {
    text-align: left;
    padding-bottom: 0;
}
.hero-label { display: none; } /* label shown via .hero-cal-unit instead */
.hero-cal-row {
    display: flex;
    align-items: flex-end;
    gap: 18px;
    margin-top: 26px;
    margin-bottom: 0;
}
.hero-cal-val {
    font-family: var(--serif);
    font-size: 5.75rem; /* 92px */
    font-weight: 400;
    letter-spacing: -0.022em;
    line-height: 0.82;
    color: var(--ink);
    font-variant-numeric: lining-nums;
}
.hero-cal-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding-bottom: 8px;
}
.hero-cal-unit {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--faint);
    font-weight: 400;
    line-height: 1.2;
}
.hero-cal-goal {
    font-family: var(--sans);
    font-size: 14px;
    letter-spacing: 0;
    color: var(--soft);
    font-weight: 400;
    line-height: 1.3;
    text-transform: none;
}

/* ── Progress bars ───────────────────────────────────────── */
/* Hero calorie bar — 3px, accent fill */
.progress-bar-track {
    height: 3px;
    background: var(--line);
    border-radius: 2px;
    box-shadow: none;
    margin: 22px 0 4px;
    overflow: hidden;
}
.progress-bar-fill {
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.4s ease;
}
.progress-bar-fill.over { background: var(--accent); }

/* Macro/goal bars — 4px, ink fill (accent when over) */
.progress-bar-track.stat-bar {
    height: 4px;
    background: var(--line2);
    border-radius: 3px;
    margin-top: 8px;
    margin-bottom: 0;
}
.progress-bar-track.stat-bar .progress-bar-fill {
    background: var(--ink);
    border-radius: 3px;
}
.progress-bar-track.stat-bar .progress-bar-fill.over {
    background: var(--accent);
}

/* ── Dashboard — macro / goal stats grid ─────────────────── */
.dash-goals {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 26px;
    margin-top: 0;
}
.goal-stat {
    display: grid;
    grid-template-areas: "name val" "target target" "bar bar";
    grid-template-columns: 1fr auto;
    align-items: baseline;
    gap: 0;
    padding: 14px 0;
    border-top: 1px solid var(--line);
    line-height: 1;
    flex-wrap: unset;
}
.goal-stat:nth-child(1),
.goal-stat:nth-child(2) { border-top: 0; padding-top: 10px; }
.goal-val {
    grid-area: val;
    font-family: var(--serif);
    font-size: 1.3125rem; /* 21px */
    font-weight: 500;
    color: var(--ink);
    letter-spacing: 0;
    line-height: 1;
}
.goal-unit {
    grid-area: name;
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 400;
    color: var(--soft);
    line-height: 1;
}
.goal-target {
    grid-area: target;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.5px;
    color: var(--faint);
    width: auto;
    margin-top: 6px;
}
.progress-bar-track.stat-bar { grid-area: bar; }

/* ── Dashboard — quick log chips ─────────────────────────── */
.quick-log-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 18px 0 12px;
}
.btn-quick-text {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 10px 6px;
    border-radius: 12px;
    background: transparent;
    border: 1px solid var(--line);
    box-shadow: none;
    color: var(--soft);
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    text-decoration: none;
    text-align: center;
    gap: 3px;
    transition: background 0.15s, color 0.15s;
}
.btn-quick-text:active { background: var(--line2); transform: none; box-shadow: none; }
@media (hover: hover) {
    .btn-quick-text:hover { background: var(--line2); color: var(--ink); box-shadow: none; }
}
.btn-plus  { font-size: 15px; font-weight: 400; line-height: 1; }
.btn-label { font-size: 11px; line-height: 1.2; }
/* Reset the narrow-screen stacking override */
@media (max-width: 600px) {
    .btn-quick-text {
        flex-direction: row;
        gap: 3px;
        min-height: 46px;
        padding: 10px 4px;
    }
    .btn-plus  { font-size: 14px; font-weight: 400; }
    .btn-label { font-size: 10px; }
}

/* ── Dashboard — water line ──────────────────────────────── */
.water-tracker {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--faint);
    text-align: left;
    margin-bottom: 14px;
}

/* ── Dashboard — food entry list ─────────────────────────── */
.meal-group-header {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--soft);
    padding: 12px 0 4px;
    gap: 8px;
}
.meal-group-header::after { background: var(--line); opacity: 1; }

.food-entry {
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    padding: 10px 0;
    margin: 0;
}
.food-entry:nth-child(even) { background: transparent; }
a.food-entry { margin: 0; width: 100%; }
a.food-entry:nth-child(even) { background: transparent; }
a.food-entry:active { background: var(--line2); }

.food-name { font-weight: 500; color: var(--ink); }
.food-meta, .food-macros { color: var(--faint); font-size: 0.8125rem; }
.food-cal {
    font-family: var(--serif);
    font-size: 1.3125rem; /* 21px */
    font-weight: 400;
    color: var(--ink);
    letter-spacing: 0;
    min-width: auto;
}

.list-total {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--soft);
    border-bottom: 1px solid var(--line);
    margin-bottom: 0;
    padding-bottom: 8px;
}

/* ── Forms — section labels ──────────────────────────────── */
.form-section { margin-bottom: 0; }
.form-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--soft);
    padding: 18px 0 12px;
    border-bottom: none;
    margin-bottom: 0;
    white-space: nowrap;
}
.form-section-title::before { display: none; }
.form-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--line);
    display: block;
}

/* ── Forms — field labels ────────────────────────────────── */
.form-row { margin-bottom: 10px; }
.form-row label,
label[for] {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--faint);
    font-weight: 400;
    margin-bottom: 7px;
}

/* ── Forms — inputs & selects (underline only) ───────────── */
input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="password"],
select,
textarea {
    border: none;
    border-bottom: 1.5px solid var(--line);
    border-radius: 0;
    background: transparent;
    padding: 9px 0;
    font-family: var(--serif);
    font-size: 1.25rem; /* 20px */
    color: var(--ink);
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}
input[type="date"] { font-size: 1rem; } /* date picker needs legible size */
input::placeholder { color: var(--faint); font-family: var(--serif); font-size: inherit; }
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: none;
}
select {
    font-size: 1.0625rem; /* 17px — spec */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A69D8E' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 9.5 12 16l7-6.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 2px center;
    background-size: 16px;
    padding-right: 24px;
    cursor: pointer;
}
textarea {
    font-size: 1rem;
    resize: vertical;
}

/* ── Forms — row layout ──────────────────────────────────── */
.form-row-inline { gap: 22px; }
.macro-inputs    { gap: 0 22px; }

/* ── Forms — scan + clear chips ─────────────────────────── */
.input-with-scan { gap: 10px; }
.btn-field-clear {
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--soft);
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 500;
    min-height: 40px;
    min-width: 40px;
    padding: 0 10px;
    box-shadow: none;
    transition: background 0.15s;
}
.btn-field-clear:hover  { background: var(--line2); color: var(--ink); border-color: var(--line); }
.btn-field-clear:active { background: var(--line2); }

/* General .btn-icon (scan button, nav arrows outside date-nav) */
.btn-icon {
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--soft);
    font-family: var(--sans);
    font-weight: 500;
    letter-spacing: 0.02em;
    box-shadow: none;
    transition: background 0.15s;
    min-height: 40px;
    min-width: 40px;
    padding: 0 10px;
}
.btn-icon:active { background: var(--line2); border-color: var(--line); }

/* ── Buttons — primary CTA ───────────────────────────────── */
.btn {
    border-radius: 14px;
    min-height: 54px;
    font-family: var(--sans);
    font-size: 15px;
    letter-spacing: 0.02em;
    transition: opacity 0.15s;
}
.btn:active { transform: none; }
.btn-primary {
    background: var(--ink);
    color: var(--paper);
    box-shadow: none;
    font-weight: 600;
}
.btn-primary:active { box-shadow: none; opacity: 0.85; }
.btn-secondary {
    background: transparent;
    color: var(--faint);
    border: 1px solid var(--line);
    box-shadow: none;
}
.btn-secondary:active { box-shadow: none; background: var(--line2); }
.btn-danger {
    background: var(--ink);
    color: var(--paper);
    box-shadow: none;
}
.btn-danger:active { box-shadow: none; opacity: 0.85; }
.btn-block { margin-top: 18px; }

/* ── Chart — segmented control ───────────────────────────── */
.chart-range-row {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
    margin-bottom: 16px;
}
.chart-range-btn {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.5px;
    padding: 6px 14px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: var(--faint);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.chart-range-btn.active {
    background: var(--ink);
    color: var(--paper);
    border-color: transparent;
}
@media (hover: hover) {
    .chart-range-btn:not(.active):hover { color: var(--soft); }
}

/* ── Metric entry list ───────────────────────────────────── */
.weight-entry {
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    padding: 12px 0;
    margin: 0;
    background: transparent;
}
.weight-entry:nth-child(even) { background: transparent; }
.weight-val {
    font-family: var(--serif);
    font-size: 1.3125rem;
    font-weight: 400;
    color: var(--ink);
    letter-spacing: 0;
}
.weight-date, .weight-notes { font-size: 0.8125rem; color: var(--faint); }
.btn-delete { color: var(--faint); }
.btn-delete:active { color: var(--accent); background: transparent; }

/* ── Autocomplete dropdown ───────────────────────────────── */
.autocomplete-list {
    background: var(--card);
    border: 1px solid var(--line);
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 24px rgba(26,22,16,0.10);
}
.autocomplete-item:active { background: var(--line2); }
.ac-name  { color: var(--ink); }
.ac-brand { color: var(--faint); }
.ac-meta  { color: var(--faint); }
.ac-footer.ac-end {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--faint);
}
.ac-spinner { border-top-color: var(--accent); }

/* ── Utility text ────────────────────────────────────────── */
.text-muted {
    font-family: var(--sans);
    font-size: 0.875rem;
    letter-spacing: 0;
    color: var(--faint);
    text-transform: none;
}
.loading {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--faint);
}
.error       { color: var(--accent); }
.success-msg { color: #3FA277; }

/* ── Toast ───────────────────────────────────────────────── */
.toast {
    font-family: var(--sans);
    border-radius: 12px;
    border-left: 3px solid transparent;
}
.toast-success { background: var(--ink); color: var(--paper); border-left-color: var(--accent); }
.toast-error   { background: var(--ink); color: var(--paper); border-left-color: var(--accent); }
.toast-info    { background: var(--ink); color: var(--paper); border-left-color: var(--faint); }
#toast-container { bottom: calc(90px + env(safe-area-inset-bottom, 0px)); }

/* ── Scanner (keep functional, update accent) ────────────── */
#scanner-reticle { border-color: var(--accent); }
#scanner-line     { background: var(--accent); }
#scanner-torch.torch-on { background: var(--accent); border-color: var(--accent); color: var(--paper); }

/* ── Reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .progress-bar-fill,
    .btn-quick-text,
    .chart-range-btn,
    .btn-field-clear,
    .btn-icon { transition: none; }
}
