/* ============================================================
   DrinkLog – Custom Styles (v2 redesign)
   Mobile-first, Bootstrap 5 dark/light mode
   Direction : wellness éditorial — Fraunces + Inter, gradients doux,
   couleurs sémantiques désaturées, ton non-culpabilisant.
   ============================================================ */

/* ============================================================
   TOKENS (light)
   ============================================================ */
:root {
    /* Brand — violet préservé, gradient pour les surfaces marquées */
    --dl-primary:        #7c3aed;
    --dl-primary-light:  #a78bfa;
    --dl-primary-soft:   #f3f0ff;
    --dl-primary-hover:  #6d28d9;
    --dl-grad-primary:   linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);

    /* Semantic — desaturé pour rester respectueux */
    --dl-dry:            #16a34a;
    --dl-dry-light:      #4ade80;
    --dl-dry-soft:       #ecfdf5;
    --dl-grad-dry:       linear-gradient(135deg, #4ade80 0%, #16a34a 100%);

    --dl-ok:             #d97706;
    --dl-ok-light:       #fbbf24;
    --dl-ok-soft:        #fffbeb;
    --dl-grad-warm:      linear-gradient(135deg, #fbbf24 0%, #d97706 100%);

    --dl-over:           #dc2626;
    --dl-over-light:     #f87171;
    --dl-over-soft:      #fef2f2;
    --dl-grad-over:      linear-gradient(135deg, #f87171 0%, #dc2626 100%);

    /* Spirit (alcool fort) — brun cognac */
    --dl-spirit:         #78350f;
    --dl-spirit-soft:    #fef3c7;

    /* Neutres — fond lavande pâle, surfaces blanches */
    --dl-bg:             #faf8ff;
    --dl-surface:        #ffffff;
    --dl-surface-2:      #f5f3ff;
    --dl-border:         #ece9f7;
    --dl-text:           #1e1b29;
    --dl-text-muted:     #6b6580;
    --dl-text-subtle:    #a8a2bc;

    /* Typo */
    --dl-font-display:   'Fraunces', Georgia, 'Times New Roman', serif;
    --dl-font-body:      'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;

    /* Radii */
    --dl-radius-sm:      12px;
    --dl-radius:         20px;
    --dl-radius-lg:      28px;
    --dl-radius-pill:    999px;

    /* Shadows */
    --dl-shadow-sm:      0 2px 8px rgba(124, 58, 237, 0.04);
    --dl-shadow:         0 4px 16px rgba(124, 58, 237, 0.06), 0 1px 3px rgba(28, 25, 41, 0.04);
    --dl-shadow-lg:      0 20px 50px rgba(124, 58, 237, 0.10), 0 4px 12px rgba(28, 25, 41, 0.04);
    --dl-shadow-color:   0 8px 24px rgba(124, 58, 237, 0.25);

    /* Layout */
    --dl-bottom-height:  68px;

    /* Bootstrap overrides */
    --bs-primary:        var(--dl-primary);
    --bs-body-font-family: var(--dl-font-body);
    --bs-body-color:     var(--dl-text);
    --bs-body-bg:        var(--dl-bg);
}

/* ============================================================
   TOKENS (dark)
   ============================================================ */
[data-bs-theme=dark] {
    --dl-primary:        #a78bfa;
    --dl-primary-light:  #c4b5fd;
    --dl-primary-soft:   #2a1f4a;
    --dl-primary-hover:  #c4b5fd;
    --dl-grad-primary:   linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);

    --dl-dry:            #4ade80;
    --dl-dry-light:      #86efac;
    --dl-dry-soft:       #0a2e1a;
    --dl-grad-dry:       linear-gradient(135deg, #4ade80 0%, #22c55e 100%);

    --dl-ok:             #fbbf24;
    --dl-ok-light:       #fcd34d;
    --dl-ok-soft:        #2d1f08;

    --dl-over:           #f87171;
    --dl-over-light:     #fca5a5;
    --dl-over-soft:      #2d0e0e;

    --dl-spirit:         #f59e0b;
    --dl-spirit-soft:    #2a1808;

    --dl-bg:             #0e0a1f;
    --dl-surface:        #1a1530;
    --dl-surface-2:      #221b3d;
    --dl-border:         #2a2348;
    --dl-text:           #faf8ff;
    --dl-text-muted:     #a8a2bc;
    --dl-text-subtle:    #6b6580;

    --dl-shadow-sm:      0 2px 8px rgba(0, 0, 0, 0.3);
    --dl-shadow:         0 4px 16px rgba(0, 0, 0, 0.3);
    --dl-shadow-lg:      0 20px 50px rgba(0, 0, 0, 0.4);
    --dl-shadow-color:   0 8px 24px rgba(124, 58, 237, 0.4);
}

/* ============================================================
   BASE
   ============================================================ */
body {
    font-family: var(--dl-font-body);
    background: var(--dl-bg);
    color: var(--dl-text);
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
    position: relative;
    min-height: 100vh;
}

/* Ambient blobs en arrière-plan (subtils) */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 10% 0%, rgba(167, 139, 250, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 90% 100%, rgba(251, 191, 36, 0.025) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}
[data-bs-theme=dark] body::before {
    background:
        radial-gradient(circle at 10% 0%, rgba(167, 139, 250, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 90% 100%, rgba(124, 58, 237, 0.04) 0%, transparent 50%);
}
main { position: relative; z-index: 1; }

/* Headings en Fraunces */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--dl-font-display);
    font-weight: 500;
    letter-spacing: -0.02em;
}

/* ============================================================
   NAVBAR (top)
   ============================================================ */
.dl-navbar {
    background: var(--dl-grad-primary) !important;
    border-bottom: none;
    box-shadow: 0 2px 12px rgba(124, 58, 237, 0.15);
    padding: 8px 0;
}
.dl-navbar .navbar-brand {
    color: #fff !important;
    font-family: var(--dl-font-display);
    font-weight: 500;
    font-size: 1.375rem;
    letter-spacing: -0.025em;
}

/* Navbar action buttons — dedicated styles, no Bootstrap btn-outline-* */
.dl-navbar-icon-btn,
.dl-navbar-link,
.dl-navbar-logout {
    background: transparent !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    border-radius: var(--dl-radius-sm) !important;
    padding: 6px 12px;
    font-weight: 500;
    transition: background-color .15s, border-color .15s;
}
.dl-navbar-icon-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
    line-height: 1;
}
.dl-navbar-icon-btn:hover,
.dl-navbar-link:hover,
.dl-navbar-logout:hover {
    background: rgba(255, 255, 255, 0.18) !important;
    border-color: rgba(255, 255, 255, 0.7) !important;
    color: #fff !important;
}
.dl-navbar-lang {
    width: auto;
    height: 32px;
    padding: 0 22px 0 10px;
    background: transparent !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    border-radius: var(--dl-radius-sm) !important;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E") !important;
    background-position: right 6px center !important;
    background-size: 10px !important;
}
.dl-navbar-lang:focus {
    box-shadow: none;
    border-color: rgba(255, 255, 255, 0.7) !important;
}
.dl-navbar-lang option {
    color: #212529;
}
.dl-navbar-link.is-active {
    background: rgba(255, 255, 255, 0.25) !important;
    border-color: #fff !important;
    color: #fff !important;
    font-weight: 600;
}
.dl-navbar-logout {
    border-color: rgba(255, 200, 200, 0.55) !important;
}
.dl-navbar-logout:hover {
    background: rgba(255, 80, 80, 0.3) !important;
    border-color: rgba(255, 200, 200, 0.9) !important;
}

[data-bs-theme=dark] .dl-navbar {
    background: linear-gradient(135deg, #4c1d95 0%, #3b1d8a 100%) !important;
}

/* Logo lockup dans la navbar */
.dl-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(10px);
    margin-right: 8px;
    vertical-align: middle;
}
.dl-brand-mark svg { width: 60%; height: 60%; }

/* ============================================================
   CARDS
   ============================================================ */
.dl-card {
    border-radius: var(--dl-radius);
    background: var(--dl-surface);
    border: 1px solid var(--dl-border);
    box-shadow: var(--dl-shadow-sm);
    transition: box-shadow .2s, transform .15s;
}
.dl-card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--dl-border);
    font-family: var(--dl-font-display);
    font-weight: 500;
    font-size: 1.0625rem;
    letter-spacing: -0.015em;
    padding: 16px 20px;
}
[data-bs-theme=dark] .dl-card {
    border-color: var(--dl-border);
    box-shadow: 0 2px 12px rgba(0,0,0,.25);
}

/* ============================================================
   STAT NUMBER (legacy class, preserved + serif)
   ============================================================ */
.dl-stat-number {
    font-family: var(--dl-font-display);
    font-size: 2.25rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.03em;
    margin-bottom: .25rem;
}

/* ============================================================
   HERO RING (dashboard)
   ============================================================ */
.dl-hero-ring {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 8px 4px 0;
}
.ring-wrap {
    width: 140px;
    height: 140px;
    position: relative;
    flex-shrink: 0;
}
.ring-wrap svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}
.ring-track {
    fill: none;
    stroke: var(--dl-surface-2);
    stroke-width: 12;
}
.ring-fill {
    fill: none;
    stroke-width: 12;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s ease;
}
.ring-fill.dry  { stroke: url(#dl-grad-dry); }
.ring-fill.ok   { stroke: url(#dl-grad-ok); }
.ring-fill.over { stroke: url(#dl-grad-over); }
.ring-fill.empty { stroke: var(--dl-text-subtle); opacity: 0.3; }

.ring-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.ring-center .num {
    font-family: var(--dl-font-display);
    font-weight: 500;
    font-size: 2.25rem;
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--dl-text);
}
.ring-center .num-dry {
    font-size: 2rem;
}
.ring-center .sub {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--dl-text-muted);
    font-weight: 600;
    margin-top: 4px;
}
.hero-meta { flex: 1; min-width: 0; }
.hero-meta .label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
    color: var(--dl-text-subtle);
    margin-bottom: 4px;
}
.hero-meta .headline {
    font-family: var(--dl-font-display);
    font-size: 1.0625rem;
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: -0.015em;
    color: var(--dl-text);
}
.hero-meta .headline strong { font-weight: 600; }
.hero-meta .headline .good { color: var(--dl-dry); }
.hero-meta .headline .warn { color: var(--dl-ok); }
.hero-meta .headline .bad  { color: var(--dl-over); }

/* Mini-stats row (3 colonnes sous le ring) */
.dl-mini-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}
.dl-mini-stat {
    background: var(--dl-surface);
    border: 1px solid var(--dl-border);
    border-radius: var(--dl-radius-sm);
    padding: 12px 10px;
    text-align: center;
    box-shadow: var(--dl-shadow-sm);
}
.dl-mini-stat .val {
    font-family: var(--dl-font-display);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1;
    color: var(--dl-text);
}
.dl-mini-stat .val small {
    font-family: var(--dl-font-body);
    font-size: 0.625rem;
    color: var(--dl-text-muted);
    font-weight: 500;
}
.dl-mini-stat .lbl {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--dl-text-muted);
    font-weight: 600;
    margin-top: 6px;
}
.dl-mini-stat .accent-good { color: var(--dl-dry); }
.dl-mini-stat .accent-warn { color: var(--dl-ok); }
.dl-mini-stat .accent-bad  { color: var(--dl-over); }

/* ============================================================
   ACTIONS row (primary + dry compact)
   ============================================================ */
.dl-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}
.dl-action-primary {
    background: var(--dl-grad-primary);
    color: white;
    border: none;
    border-radius: var(--dl-radius);
    padding: 16px 20px;
    font-weight: 600;
    font-size: 0.9375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: transform .1s, box-shadow .15s;
    box-shadow: var(--dl-shadow-color);
    position: relative;
    overflow: hidden;
}
.dl-action-primary::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 100%; height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.25) 0%, transparent 70%);
    pointer-events: none;
}
.dl-action-primary > * { position: relative; z-index: 1; }
.dl-action-primary:hover { transform: translateY(-1px); color: white; }
.dl-action-primary:active { transform: scale(0.98); }
.dl-action-primary:disabled,
.dl-action-primary.disabled {
    opacity: 0.5; cursor: not-allowed; transform: none;
}

.dl-action-dry {
    background: var(--dl-dry-soft);
    border: 1.5px solid transparent;
    color: var(--dl-dry);
    border-radius: var(--dl-radius);
    width: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.375rem;
    transition: background .15s, color .15s, transform .1s;
}
.dl-action-dry:hover {
    background: var(--dl-dry);
    color: white;
    transform: translateY(-1px);
}
.dl-action-dry:active { transform: scale(0.96); }
.dl-action-dry.active {
    background: var(--dl-grad-dry);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(22,163,74,.30);
}

/* Legacy .dl-dry-btn — preserved for forms still using it (auth tour) */
.dl-dry-btn {
    border-radius: var(--dl-radius);
    background: var(--dl-grad-dry);
    border: none;
    color: #fff;
    box-shadow: 0 4px 14px rgba(22,163,74,.30);
    transition: transform .1s, box-shadow .1s;
    padding: 16px 20px;
    font-weight: 600;
}
.dl-dry-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(22,163,74,.40);
    color: #fff;
}
.dl-dry-btn:active { transform: translateY(0); }

/* ============================================================
   WEEK BLOCK (dashboard, summary of the current week)
   ============================================================ */
.dl-week-block {
    background: var(--dl-surface);
    border: 1px solid var(--dl-border);
    border-radius: var(--dl-radius);
    padding: 16px 18px;
    box-shadow: var(--dl-shadow-sm);
}
.dl-week-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 14px;
}
.dl-week-head .l {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--dl-text-subtle);
    font-weight: 600;
}
.dl-week-head .v {
    font-family: var(--dl-font-display);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--dl-text);
}
.dl-week-head .v small {
    color: var(--dl-text-muted);
    font-weight: 400;
}
.dl-week-row {
    display: flex;
    gap: 5px;
}
.dl-week-day {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: inherit;
}
.dl-week-day .bar {
    width: 100%;
    height: 44px;
    background: var(--dl-surface-2);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}
.dl-week-day .bar .fill {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    border-radius: 8px;
    background: var(--dl-text-subtle);
}
.dl-week-day.dry  .bar .fill { background: var(--dl-grad-dry); height: 4px; }
.dl-week-day.ok   .bar .fill { background: var(--dl-grad-warm); }
.dl-week-day.over .bar .fill { background: var(--dl-grad-over); }
.dl-week-day .label {
    font-size: 0.6875rem;
    color: var(--dl-text-muted);
    font-weight: 600;
}
.dl-week-day.today .label { color: var(--dl-primary); font-weight: 700; }
.dl-week-day.today .bar   { box-shadow: 0 0 0 2px var(--dl-primary); }

/* ============================================================
   ENTRIES LIST (dashboard)
   ============================================================ */
.dl-entry-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.dl-entry {
    background: var(--dl-surface);
    border: 1px solid var(--dl-border);
    border-radius: var(--dl-radius);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    box-shadow: var(--dl-shadow-sm);
    transition: transform .15s, box-shadow .15s;
}
.dl-entry:hover {
    transform: translateY(-1px);
    box-shadow: var(--dl-shadow);
}
.dl-entry-icon {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: var(--dl-primary-soft);
    display: flex; align-items: center; justify-content: center;
    color: var(--dl-primary);
    flex-shrink: 0;
    font-size: 1.125rem;
}
.dl-entry-icon.wine    { background: var(--dl-over-soft);    color: var(--dl-over); }
.dl-entry-icon.beer    { background: var(--dl-ok-soft);      color: var(--dl-ok); }
.dl-entry-icon.cocktail{ background: var(--dl-primary-soft); color: var(--dl-primary); }
.dl-entry-icon.spirit  { background: var(--dl-spirit-soft);  color: var(--dl-spirit); }
.dl-entry-icon.dry     { background: var(--dl-dry-soft);     color: var(--dl-dry); }

.dl-entry-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.dl-entry-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--dl-text);
    margin: 0;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dl-entry-meta {
    font-size: 0.75rem;
    color: var(--dl-text-muted);
}
.dl-entry-units {
    font-family: var(--dl-font-display);
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--dl-text);
    letter-spacing: -0.02em;
    flex-shrink: 0;
}
.dl-entry-units small {
    font-family: var(--dl-font-body);
    font-size: 0.625rem;
    color: var(--dl-text-muted);
    font-weight: 500;
}
.dl-entry-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.dl-entry-actions .btn {
    padding: 4px 8px;
    line-height: 1;
}

/* ============================================================
   NOTE QUOTE (dashboard)
   ============================================================ */
.dl-note {
    padding: 18px 20px;
    background: linear-gradient(135deg, var(--dl-primary-soft) 0%, var(--dl-surface) 100%);
    border: 1px solid var(--dl-border);
    border-radius: var(--dl-radius);
    position: relative;
    overflow: hidden;
}
.dl-note::before {
    content: '"';
    position: absolute;
    top: -16px; right: 10px;
    font-family: var(--dl-font-display);
    font-size: 6rem;
    color: var(--dl-primary);
    opacity: 0.12;
    line-height: 1;
    pointer-events: none;
}
.dl-note-label {
    font-size: 0.6875rem;
    color: var(--dl-text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}
.dl-note textarea {
    background: transparent;
    border: none;
    color: var(--dl-text);
    font-family: var(--dl-font-display);
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.5;
    font-style: italic;
    width: 100%;
    resize: vertical;
    padding: 0;
    box-shadow: none !important;
    outline: none !important;
    position: relative;
}
.dl-note textarea::placeholder {
    color: var(--dl-text-subtle);
    font-style: italic;
}

/* ============================================================
   FAB (Floating Action Button)
   ============================================================ */
.dl-fab {
    position: fixed;
    bottom: calc(var(--dl-bottom-height) + 20px + env(safe-area-inset-bottom));
    right: 20px;
    width: 58px; height: 58px;
    border-radius: 50%;
    background: var(--dl-grad-primary);
    color: white;
    border: none;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--dl-shadow-color), 0 16px 32px rgba(124, 58, 237, 0.3);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1020;
    transition: transform .15s;
}
.dl-fab:hover { transform: scale(1.05); color: white; }
.dl-fab:active { transform: scale(0.95); }
.dl-fab::before {
    content: '';
    position: absolute;
    top: 4px; left: 12px;
    width: 30%; height: 25%;
    background: rgba(255,255,255,0.4);
    border-radius: 50%;
    filter: blur(4px);
    pointer-events: none;
}
@media (min-width: 768px) {
    .dl-fab {
        bottom: 24px;
    }
}

/* ============================================================
   BOTTOM SHEET (add-drink form)
   ============================================================ */
.dl-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(28, 25, 41, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}
.dl-sheet-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.dl-sheet {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--dl-surface);
    border-radius: var(--dl-radius-lg) var(--dl-radius-lg) 0 0;
    /* Padding bottom = safe-area + bottom-nav height (mobile only — see below) */
    padding: 12px 20px calc(20px + env(safe-area-inset-bottom));
    z-index: 1050; /* above bottom-nav (1030) and backdrop */
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.dl-sheet.open {
    transform: translateY(0);
}
/* Mobile : add bottom padding so the submit button clears the fixed bottom-nav */
@media (max-width: 767.98px) {
    .dl-sheet {
        padding-bottom: calc(20px + var(--dl-bottom-height) + env(safe-area-inset-bottom));
    }
}

/* Sans JS — le sheet est statique en bas de page */
.no-js .dl-sheet {
    position: relative;
    transform: none;
    border-radius: var(--dl-radius);
    max-height: none;
    margin-top: 16px;
    box-shadow: var(--dl-shadow-sm);
    border: 1px solid var(--dl-border);
}
.no-js .dl-sheet-backdrop,
.no-js .dl-sheet-grabber,
.no-js .dl-sheet-close { display: none; }

.dl-sheet-grabber {
    width: 40px;
    height: 4px;
    background: var(--dl-border);
    border-radius: 2px;
    margin: 0 auto 16px;
}
.dl-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}
.dl-sheet-head h3 {
    font-family: var(--dl-font-display);
    font-weight: 500;
    font-size: 1.375rem;
    letter-spacing: -0.02em;
    margin: 0;
}
.dl-sheet-close {
    background: var(--dl-surface-2);
    border: none;
    border-radius: 50%;
    width: 32px; height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--dl-text-muted);
    cursor: pointer;
    font-size: 1rem;
}
.dl-sheet-close:hover { color: var(--dl-text); }
.dl-sheet-sub {
    font-size: 0.8125rem;
    color: var(--dl-text-muted);
    margin: 4px 0 20px;
}
body.sheet-open { overflow: hidden; }

/* Inputs dans le sheet — style "papier" sans bordure visible */
.dl-input {
    background: var(--dl-surface-2);
    border: 1.5px solid transparent;
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 0.9375rem;
    width: 100%;
    font-weight: 500;
    color: var(--dl-text);
    transition: border-color .15s, background .15s;
}
.dl-input:focus {
    outline: none;
    border-color: var(--dl-primary);
    background: var(--dl-surface);
}
.dl-input-label {
    display: block;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--dl-text-muted);
    font-weight: 600;
    margin-bottom: 6px;
}
.dl-input-group {
    position: relative;
}
.dl-input-group .dl-input-unit {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8125rem;
    color: var(--dl-text-subtle);
    font-weight: 500;
    pointer-events: none;
}
.dl-input-group input.dl-input { padding-right: 36px; }

/* Live preview unit pill (replaces the .alert-info) */
.dl-preview-pill {
    margin: 14px 0;
    padding: 12px 16px;
    background: var(--dl-primary-soft);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--dl-primary);
}
.dl-preview-pill .l {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.dl-preview-pill .v {
    font-family: var(--dl-font-display);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.dl-sheet-submit {
    width: 100%;
    background: var(--dl-grad-primary);
    color: white;
    border: none;
    border-radius: var(--dl-radius);
    padding: 16px;
    font-weight: 600;
    font-size: 0.9375rem;
    margin-top: 14px;
    box-shadow: var(--dl-shadow-color);
    cursor: pointer;
    transition: transform 0.1s;
}
.dl-sheet-submit:hover { color: white; transform: translateY(-1px); }
.dl-sheet-submit:active { transform: scale(0.98); }

/* ============================================================
   DATE PICKER PILL (top of dashboard)
   ============================================================ */
.dl-date-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--dl-surface);
    border: 1px solid var(--dl-border);
    border-radius: var(--dl-radius-pill);
    padding: 8px 14px;
    font-size: 0.8125rem;
    color: var(--dl-text-muted);
    font-weight: 500;
    box-shadow: var(--dl-shadow-sm);
}
.dl-date-pill input[type=date] {
    border: none;
    background: transparent;
    color: var(--dl-text);
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0;
    font-family: var(--dl-font-body);
}
.dl-date-pill input[type=date]:focus {
    outline: none;
}
.dl-date-pill .btn {
    padding: 2px 10px;
    font-size: 0.75rem;
    border-radius: var(--dl-radius-pill);
}

/* ============================================================
   APP HEADER (dashboard greeting)
   ============================================================ */
.dl-app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.dl-app-header .dl-greeting {
    font-size: 0.8125rem;
    color: var(--dl-text-muted);
    font-weight: 500;
}
.dl-app-header h1 {
    font-family: var(--dl-font-display);
    font-weight: 500;
    font-size: 1.5rem;
    letter-spacing: -0.025em;
    margin: 2px 0 0;
    color: var(--dl-text);
}
.dl-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--dl-grad-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-family: var(--dl-font-display);
    font-weight: 600;
    font-size: 1rem;
    box-shadow: var(--dl-shadow-color);
    text-decoration: none;
    flex-shrink: 0;
    transition: transform .1s;
}
.dl-avatar:hover { color: white; transform: scale(1.05); }

/* ============================================================
   APP ICON (auth pages)
   ============================================================ */
.dl-app-icon {
    width: 72px; height: 72px;
    background: var(--dl-grad-primary);
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto;
    color: #fff;
    box-shadow: var(--dl-shadow-color);
    position: relative;
    overflow: hidden;
}
.dl-app-icon::before {
    content: '';
    position: absolute;
    top: -30%; left: -30%;
    width: 80%; height: 80%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}
.dl-app-icon svg {
    width: 52%;
    height: 52%;
    position: relative;
    z-index: 1;
}

/* Display-serif title utility (used on auth & onboarding) */
.dl-display-title {
    font-family: var(--dl-font-display);
    font-weight: 600;
    font-size: 1.75rem;
    letter-spacing: -0.01em;
    color: var(--dl-text);
    margin: 0;
}
.dl-display-title.dl-display-sm {
    font-size: 1.35rem;
}

/* ============================================================
   AUTH PAGES
   ============================================================ */
.dl-auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: var(--dl-bg);
    position: relative;
}
.dl-auth-container {
    width: 100%;
    max-width: 420px;
    background: var(--dl-surface);
    border: 1px solid var(--dl-border);
    border-radius: var(--dl-radius-lg);
    padding: 2rem 1.75rem;
    box-shadow: var(--dl-shadow-lg);
    position: relative;
    z-index: 1;
}

/* ============================================================
   BOTTOM NAVIGATION (mobile) — 5 onglets
   ============================================================ */
.dl-bottom-nav {
    height: var(--dl-bottom-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--dl-border);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 8px 6px;
    box-shadow: 0 -2px 12px rgba(0,0,0,.04);
    z-index: 1030;
}
[data-bs-theme=dark] .dl-bottom-nav {
    background: rgba(26, 21, 48, 0.85);
    border-color: var(--dl-border);
}

.dl-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: var(--dl-text-subtle);
    font-size: .625rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 4px 2px;
    border-radius: 12px;
    transition: color .15s;
    flex: 1;
    min-width: 0;
}
.dl-bottom-nav-item i {
    font-size: 1.25rem;
    padding: 4px 14px;
    border-radius: 12px;
    transition: background .2s;
    line-height: 1;
}
.dl-bottom-nav-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.dl-bottom-nav-item.active {
    color: var(--dl-primary);
}
.dl-bottom-nav-item.active i {
    background: var(--dl-primary-soft);
}
.dl-bottom-nav-item:hover {
    color: var(--dl-primary);
}

/* PWA safe area */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .dl-bottom-nav {
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
        height: calc(var(--dl-bottom-height) + env(safe-area-inset-bottom));
    }
}

/* ============================================================
   CALENDAR — refonte 7 colonnes
   ============================================================ */
.dl-cal-month-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.dl-cal-month-title {
    font-family: var(--dl-font-display);
    font-weight: 500;
    font-size: 1.5rem;
    letter-spacing: -0.025em;
    text-align: center;
    flex: 1;
    margin: 0;
}
.dl-cal-month-title small {
    display: block;
    font-family: var(--dl-font-body);
    font-size: 0.6875rem;
    color: var(--dl-text-muted);
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-top: 2px;
}
.dl-icon-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--dl-surface);
    border: 1px solid var(--dl-border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--dl-text-muted);
    cursor: pointer;
    box-shadow: var(--dl-shadow-sm);
    transition: transform .1s, color .15s;
    flex-shrink: 0;
}
.dl-icon-btn:hover {
    transform: scale(1.05);
    color: var(--dl-primary);
}

/* Weekly summary chip strip (replaces 8th column) */
.dl-week-summary {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 16px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.dl-week-summary::-webkit-scrollbar { display: none; }

.dl-week-chip {
    flex: 0 0 auto;
    background: var(--dl-surface);
    border: 1px solid var(--dl-border);
    border-radius: var(--dl-radius-sm);
    padding: 10px 14px;
    font-size: 0.75rem;
    box-shadow: var(--dl-shadow-sm);
    min-width: 72px;
    text-align: center;
}
.dl-week-chip .num {
    font-family: var(--dl-font-display);
    font-size: 1.125rem;
    font-weight: 600;
    display: block;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--dl-text);
}
.dl-week-chip .lbl {
    color: var(--dl-text-muted);
    font-size: 0.6875rem;
    font-weight: 500;
}
.dl-week-chip.current {
    background: var(--dl-grad-primary);
    color: white;
    border-color: transparent;
    box-shadow: var(--dl-shadow-color);
}
.dl-week-chip.current .num,
.dl-week-chip.current .lbl { color: white; }
.dl-week-chip.current .lbl { opacity: 0.8; }

/* New 7-column grid (replaces .dl-cal-header + .dl-cal-row with weekly column) */
.dl-calendar { user-select: none; }
.dl-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 8px;
    gap: 4px;
}
.dl-cal-weekdays div {
    text-align: center;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--dl-text-subtle);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 4px 0;
}
.dl-cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.dl-cal-cell {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    text-decoration: none;
    color: var(--dl-text);
    font-size: 0.875rem;
    font-weight: 600;
    position: relative;
    background: var(--dl-surface);
    border: 1px solid var(--dl-border);
    box-shadow: var(--dl-shadow-sm);
    transition: transform .1s, filter .1s;
    min-height: 44px;
    gap: 2px;
}
.dl-cal-cell:hover {
    transform: scale(1.04);
    filter: brightness(.95);
    color: inherit;
}
.dl-cal-cell:active { transform: scale(.96); }

.dl-cal-day-num {
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1;
}
.dl-cal-badge {
    font-size: 0.625rem;
    font-weight: 600;
    opacity: 0.85;
    white-space: nowrap;
}

/* Day states */
.dl-cal-other,
.dl-cal-empty {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    color: var(--dl-text-subtle);
    font-weight: 400;
}
.dl-cal-other { opacity: .3; pointer-events: none; }

.dl-cal-dry {
    background: var(--dl-grad-dry);
    border-color: transparent;
    color: white;
}
.dl-cal-dry:hover { color: white; }

.dl-cal-ok {
    background: var(--dl-ok-soft);
    border-color: var(--dl-ok-light);
    color: var(--dl-ok);
}
[data-bs-theme=dark] .dl-cal-ok {
    color: var(--dl-ok);
}

.dl-cal-over {
    background: var(--dl-over-soft);
    border-color: var(--dl-over-light);
    color: var(--dl-over);
}

.dl-cal-today {
    background: var(--dl-grad-primary);
    border-color: transparent;
    color: white;
    box-shadow: var(--dl-shadow-color);
}
.dl-cal-today:hover { color: white; }
.dl-cal-today.dl-cal-dry { background: var(--dl-grad-dry); box-shadow: 0 0 0 2.5px var(--dl-primary); }
.dl-cal-today.dl-cal-ok  { box-shadow: 0 0 0 2.5px var(--dl-primary); background: var(--dl-ok-soft); color: var(--dl-ok); }
.dl-cal-today.dl-cal-over{ box-shadow: 0 0 0 2.5px var(--dl-primary); background: var(--dl-over-soft); color: var(--dl-over); }

/* Note dot indicator */
.dl-cal-note-dot {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.7;
}

/* Legend pills */
.dl-legend {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--dl-radius-pill);
    font-size: .6875rem;
    font-weight: 600;
    background: var(--dl-surface);
    border: 1px solid var(--dl-border);
}
.dl-legend::before {
    content: '';
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
}
.dl-legend-dry::before   { background: var(--dl-dry); }
.dl-legend-ok::before    { background: var(--dl-ok); }
.dl-legend-over::before  { background: var(--dl-over); }
.dl-legend-empty::before { background: var(--dl-text-subtle); }
.dl-legend-dry   { color: var(--dl-dry); }
.dl-legend-ok    { color: var(--dl-ok); }
.dl-legend-over  { color: var(--dl-over); }
.dl-legend-empty { color: var(--dl-text-muted); }

/* Monthly insight card (bottom of calendar) */
.dl-insight {
    padding: 24px;
    background: var(--dl-grad-primary);
    color: white;
    border-radius: var(--dl-radius);
    position: relative;
    overflow: hidden;
    box-shadow: var(--dl-shadow-color);
}
.dl-insight::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 160px; height: 160px;
    background: radial-gradient(circle, rgba(255,255,255,0.20) 0%, transparent 70%);
    pointer-events: none;
}
.dl-insight::after {
    content: '';
    position: absolute;
    bottom: -60px; left: -20px;
    width: 140px; height: 140px;
    background: radial-gradient(circle, rgba(251, 191, 36, 0.25) 0%, transparent 70%);
    pointer-events: none;
}
.dl-insight-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
    opacity: 0.85;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}
.dl-insight-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    position: relative;
}
.dl-insight-stat {
    position: relative;
}
.dl-insight-stat .v {
    font-family: var(--dl-font-display);
    font-size: 1.625rem;
    font-weight: 500;
    letter-spacing: -0.025em;
    line-height: 1.1;
    color: white;
}
.dl-insight-stat .l {
    font-size: 0.75rem;
    opacity: 0.85;
    margin-top: 2px;
}

/* ============================================================
   STATS — hero card + KPI quad + charts
   ============================================================ */
.dl-stats-hero {
    padding: 24px;
    background: var(--dl-grad-primary);
    color: white;
    border-radius: var(--dl-radius-lg);
    position: relative;
    overflow: hidden;
    box-shadow: var(--dl-shadow-color);
    margin-bottom: 16px;
}
.dl-stats-hero::before {
    content: '';
    position: absolute;
    top: -50px; right: -50px;
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(251, 191, 36, 0.25) 0%, transparent 70%);
    pointer-events: none;
}
.dl-stats-hero .label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
    opacity: 0.85;
    position: relative;
}
.dl-stats-hero .number {
    font-family: var(--dl-font-display);
    font-size: 3rem;
    font-weight: 400;
    line-height: 1;
    letter-spacing: -0.04em;
    margin-top: 6px;
    position: relative;
}
.dl-stats-hero .sub {
    margin-top: 10px;
    font-size: 0.875rem;
    opacity: 0.9;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.dl-stats-hero .delta {
    background: rgba(255,255,255,0.2);
    padding: 3px 10px;
    border-radius: var(--dl-radius-pill);
    font-weight: 600;
    font-size: 0.75rem;
}

/* KPI quad — wellness card style */
.dl-kpi {
    background: var(--dl-surface);
    border: 1px solid var(--dl-border);
    border-radius: var(--dl-radius);
    padding: 16px 18px;
    box-shadow: var(--dl-shadow-sm);
    height: 100%;
}
.dl-kpi-icon {
    width: 32px; height: 32px;
    border-radius: 10px;
    background: var(--dl-primary-soft);
    color: var(--dl-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9375rem;
    margin-bottom: 8px;
}
.dl-kpi-icon.green { background: var(--dl-dry-soft); color: var(--dl-dry); }
.dl-kpi-icon.amber { background: var(--dl-ok-soft);  color: var(--dl-ok); }
.dl-kpi-icon.red   { background: var(--dl-over-soft); color: var(--dl-over); }

.dl-kpi-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--dl-text-muted);
}
.dl-kpi-value {
    font-family: var(--dl-font-display);
    font-size: 1.625rem;
    font-weight: 500;
    letter-spacing: -0.025em;
    margin-top: 4px;
    line-height: 1.1;
    color: var(--dl-text);
}
.dl-kpi-value .small {
    font-size: 0.8125rem;
    color: var(--dl-text-muted);
    font-weight: 400;
}

/* Top drinks list */
.dl-top-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 8px;
    border-radius: 12px;
}
.dl-top-item + .dl-top-item {
    border-top: 1px solid var(--dl-border);
}
.dl-top-rank {
    font-family: var(--dl-font-display);
    font-size: 0.875rem;
    color: var(--dl-text-subtle);
    width: 20px;
    font-weight: 600;
    flex-shrink: 0;
}
.dl-top-body {
    flex: 1;
    min-width: 0;
}
.dl-top-name {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 6px;
    letter-spacing: -0.01em;
    color: var(--dl-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dl-top-bar {
    height: 6px;
    background: var(--dl-surface-2);
    border-radius: 4px;
    overflow: hidden;
}
.dl-top-bar-fill {
    height: 100%;
    background: var(--dl-grad-primary);
    border-radius: 4px;
}
.dl-top-bar-fill.red { background: var(--dl-grad-over); }
.dl-top-value {
    font-family: var(--dl-font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--dl-text);
    flex-shrink: 0;
}

/* ============================================================
   INPUTS, BUTTONS, FORMS
   ============================================================ */
.form-select-lg, .form-control-lg,
.form-select, .form-control {
    border-radius: var(--dl-radius-sm) !important;
    border-color: var(--dl-border);
    background-color: var(--dl-surface);
    color: var(--dl-text);
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--dl-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.10);
}
[data-bs-theme=dark] .form-control,
[data-bs-theme=dark] .form-select {
    background-color: var(--dl-surface);
    color: var(--dl-text);
}

.input-group > .input-group-text {
    border-radius: var(--dl-radius-sm) 0 0 var(--dl-radius-sm) !important;
    background: var(--dl-surface-2);
    border-color: var(--dl-border);
    color: var(--dl-text-muted);
}
.input-group > .form-control:last-child,
.input-group > .form-select:last-child {
    border-radius: 0 var(--dl-radius-sm) var(--dl-radius-sm) 0 !important;
}
.input-group > .btn:last-child {
    border-radius: 0 var(--dl-radius-sm) var(--dl-radius-sm) 0 !important;
}

/* Bootstrap buttons */
.btn {
    border-radius: var(--dl-radius-sm);
    font-weight: 500;
    transition: transform .1s, box-shadow .15s;
}
.btn-primary {
    background: var(--dl-grad-primary) !important;
    border-color: transparent !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.18);
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--dl-grad-primary) !important;
    border-color: transparent !important;
    transform: translateY(-1px);
    box-shadow: var(--dl-shadow-color);
    color: white !important;
}
.btn-primary:active {
    transform: translateY(0);
}
.btn-outline-primary {
    color: var(--dl-primary) !important;
    border-color: var(--dl-primary) !important;
    background: transparent !important;
}
.btn-outline-primary:hover {
    background: var(--dl-primary-soft) !important;
    color: var(--dl-primary) !important;
}
.btn-success {
    background: var(--dl-grad-dry) !important;
    border-color: transparent !important;
}
.btn-success:hover {
    background: var(--dl-grad-dry) !important;
    transform: translateY(-1px);
}
.btn-outline-secondary {
    color: var(--dl-text-muted) !important;
    border-color: var(--dl-border) !important;
    background: var(--dl-surface) !important;
}
.btn-outline-secondary:hover {
    background: var(--dl-surface-2) !important;
    border-color: var(--dl-text-muted) !important;
    color: var(--dl-text) !important;
}

/* Progress bar */
.progress {
    border-radius: var(--dl-radius-pill);
    background: var(--dl-surface-2);
    overflow: hidden;
}
.progress-bar {
    background: var(--dl-grad-primary);
}
.progress-bar.bg-success { background: var(--dl-grad-dry) !important; }
.progress-bar.bg-warning { background: var(--dl-grad-warm) !important; }
.progress-bar.bg-danger  { background: var(--dl-grad-over) !important; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    border-radius: var(--dl-radius);
    border: 1px solid transparent;
    padding: 14px 16px;
}
.alert-success {
    background: var(--dl-dry-soft);
    color: var(--dl-dry);
    border-color: rgba(22, 163, 74, 0.15);
}
.alert-danger {
    background: var(--dl-over-soft);
    color: var(--dl-over);
    border-color: rgba(220, 38, 38, 0.15);
}
.alert-info {
    background: var(--dl-primary-soft);
    color: var(--dl-primary);
    border-color: rgba(124, 58, 237, 0.15);
}
.alert-warning, .alert-secondary {
    background: var(--dl-ok-soft);
    color: var(--dl-ok);
    border-color: rgba(217, 119, 6, 0.15);
}

/* ============================================================
   SPACING FOR BOTTOM NAV (mobile)
   ============================================================ */
@media (max-width: 767px) {
    main { padding-bottom: calc(var(--dl-bottom-height) + 1.5rem) !important; }
}

/* ============================================================
   NAV PILLS (auth)
   ============================================================ */
.nav-pills .nav-link {
    color: var(--dl-text-muted);
    font-weight: 500;
    border-radius: var(--dl-radius-sm);
}
.nav-pills .nav-link.active {
    background: var(--dl-grad-primary) !important;
    color: white !important;
}

/* ============================================================
   STREAK MILESTONE BANNER (legacy, refined)
   ============================================================ */
.dl-streak-banner {
    position: relative;
    background: var(--dl-grad-dry);
    color: #fff;
    border-radius: var(--dl-radius);
    padding: 1.25rem 2.5rem 1.25rem 1.25rem;
    box-shadow: 0 4px 20px rgba(22,163,74,.40);
    animation: dl-pop .35s cubic-bezier(.34,1.56,.64,1);
    overflow: hidden;
}
.dl-streak-banner::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 140px; height: 140px;
    background: radial-gradient(circle, rgba(255,255,255,0.20) 0%, transparent 70%);
}
.dl-streak-emoji { font-size: 2.5rem; line-height: 1; position: relative; }
.dl-streak-banner .fw-bold,
.dl-streak-banner .opacity-75 { position: relative; }

@keyframes dl-pop {
    from { transform: scale(.85); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

/* ============================================================
   DRAG & DROP (SortableJS) — preserved
   ============================================================ */
.dl-drag-handle {
    cursor: grab;
    font-size: 1.1rem;
    color: var(--dl-text-subtle);
    transition: color .15s;
}
.dl-drag-handle:hover { color: var(--dl-primary); }
.dl-drag-handle:active { cursor: grabbing; }
.dl-drag-ghost {
    opacity: .4;
    background: var(--dl-primary-soft) !important;
}

/* ============================================================
   OFFLINE SYNC BANNER
   ============================================================ */
.dl-sync-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--dl-grad-primary);
    color: #fff;
    padding: 12px 18px;
    border-radius: var(--dl-radius);
    margin-bottom: 1rem;
    font-size: .9rem;
    box-shadow: var(--dl-shadow-color);
}

/* ============================================================
   AUTOCOMPLETE DROPDOWN — refined
   ============================================================ */
.dl-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--dl-surface);
    border: 1px solid var(--dl-border);
    border-radius: var(--dl-radius-sm);
    box-shadow: var(--dl-shadow-lg);
    z-index: 1050;
    max-height: 260px;
    overflow-y: auto;
    margin-top: 6px;
    overscroll-behavior: contain;
}
.dl-autocomplete-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--dl-border);
    touch-action: manipulation;
    transition: background .1s;
}
.dl-autocomplete-item:last-child { border-bottom: none; }
.dl-autocomplete-item:hover,
.dl-autocomplete-item.active {
    background: var(--dl-primary-soft);
}
.dl-ac-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--dl-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.dl-autocomplete-item:hover .dl-ac-name,
.dl-autocomplete-item.active .dl-ac-name {
    color: var(--dl-primary);
}
.dl-ac-detail {
    font-size: 0.75rem;
    color: var(--dl-text-muted);
    white-space: nowrap;
}

/* ============================================================
   UTILITIES (legacy preserved)
   ============================================================ */
.fs-7 { font-size: .8rem; }

.text-primary { color: var(--dl-primary) !important; }
.text-success { color: var(--dl-dry) !important; }
.text-warning { color: var(--dl-ok) !important; }
.text-danger  { color: var(--dl-over) !important; }
.bg-primary   { background: var(--dl-primary) !important; }
.bg-success   { background: var(--dl-dry) !important; }
.bg-warning   { background: var(--dl-ok) !important; }
.bg-danger    { background: var(--dl-over) !important; }

.text-muted { color: var(--dl-text-muted) !important; }
.text-secondary { color: var(--dl-text-muted) !important; }

/* Section title (used in dashboard) */
.dl-section-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 24px 4px 12px;
}
.dl-section-title h3 {
    font-family: var(--dl-font-display);
    font-weight: 500;
    font-size: 1.125rem;
    margin: 0;
    letter-spacing: -0.02em;
    color: var(--dl-text);
}
.dl-section-title .meta {
    font-size: 0.6875rem;
    color: var(--dl-text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

/* ============================================================
   CALORIES (option opt-in)
   ============================================================ */
.dl-entry-kcal {
    font-style: italic;
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--dl-muted);
    margin-top: 2px;
    line-height: 1.2;
    white-space: nowrap;
}
.dl-day-kcal {
    font-size: 0.8rem;
    color: var(--dl-muted);
    font-style: italic;
    text-align: center;
    padding: 8px 12px;
    background: var(--dl-surface-2);
    border-radius: var(--dl-radius-sm);
}
.dl-day-kcal .dl-kcal-note {
    opacity: 0.7;
    font-size: 0.75rem;
}

/* ============================================================
   RESPONSIVE TWEAKS
   ============================================================ */
@media (max-width: 360px) {
    .dl-cal-cell { font-size: .8rem; }
    .dl-cal-day-num { font-size: .8rem; }
    .dl-cal-badge { font-size: .58rem; }
    .ring-wrap { width: 120px; height: 120px; }
    .ring-center .num { font-size: 2rem; }
}
@media (min-width: 480px) {
    .dl-cal-cell { font-size: .9rem; }
    .dl-cal-day-num { font-size: .95rem; }
    .dl-cal-badge { font-size: .68rem; }
}

/* Desktop : hide FAB and bottom nav, show top nav */
@media (min-width: 768px) {
    .dl-bottom-nav { display: none !important; }
}

/* ============================================================
   PULL TO REFRESH
   Désactive le PTR natif et fournit un indicateur custom géré en JS.
   ============================================================ */
html, body {
    overscroll-behavior-y: contain;
}

.dl-ptr-indicator {
    position: fixed;
    top: 14px;
    left: 50%;
    width: 42px;
    height: 42px;
    background: var(--dl-surface);
    border: 1px solid var(--dl-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    color: var(--dl-primary);
    font-size: 1.2rem;
    pointer-events: none;
    z-index: 1100;
    opacity: 0;
    --ptr-pull: -80px;
    --ptr-rotate: 0deg;
    transform: translateX(-50%) translateY(var(--ptr-pull));
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1),
                opacity 0.2s,
                background-color 0.15s,
                border-color 0.15s,
                color 0.15s;
}
/* Pendant l'interaction, pas de transition pour suivre le doigt */
.dl-ptr-indicator.pulling {
    transition: opacity 0.2s, background-color 0.15s, border-color 0.15s, color 0.15s;
}
.dl-ptr-indicator.visible { opacity: 1; }
.dl-ptr-indicator .bi {
    display: block;
    transform: rotate(var(--ptr-rotate));
}
.dl-ptr-indicator.ready {
    background: var(--dl-primary);
    border-color: var(--dl-primary);
    color: #fff;
}
.dl-ptr-indicator.refreshing .bi {
    animation: dl-ptr-spin 0.7s linear infinite;
}
@keyframes dl-ptr-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
