/* ═══════════════════════════════════════════════════════════════════
   BéBé Journal — Banque de lait
   ═══════════════════════════════════════════════════════════════════ */

/* ── Onglets Tirages / Banque ────────────────────────────────────── */
.milk-tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0.25rem;
    margin-bottom: 1.25rem;
    background: var(--surface-mid);
    border: 1px solid var(--border);
    border-radius: 999px;
}
.milk-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.55rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-2);
    text-decoration: none;
    transition: background 0.18s, color 0.18s;
}
.milk-tab svg { width: 1rem; height: 1rem; }
.milk-tab--active {
    background: var(--clay);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(196,120,90,0.3);
}

/* ── Résumé des stocks ───────────────────────────────────────────── */
.bank-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.625rem;
    margin-bottom: 1.5rem;
}
.bank-stock,
.bank-estimate {
    background: var(--surface);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--shadow-xs);
    padding: 0.875rem;
}
.bank-stock {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
}
.bank-stock-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    border-radius: var(--r-sm);
}
.bank-stock-icon svg { width: 1.2rem; height: 1.2rem; }
.bank-stock--fridge .bank-stock-icon  { background: rgba(107,158,126,0.12); color: var(--sage); }
.bank-stock--freezer .bank-stock-icon { background: rgba(61,79,114,0.10);  color: var(--night); }
.bank-stock-val {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}
.bank-stock-lbl {
    font-size: 0.7rem;
    color: var(--text-3);
}

.bank-estimate { grid-column: 1 / -1; }
.bank-estimate-head {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--clay);
    margin-bottom: 0.375rem;
}
.bank-estimate-head svg { width: 1rem; height: 1rem; }
.bank-estimate-main {
    font-family: var(--font-display), serif;
    font-size: 1.05rem;
    color: var(--text);
    margin: 0;
}
.bank-estimate-sub,
.bank-estimate-avg {
    font-size: 0.78rem;
    color: var(--text-2);
    margin: 0.25rem 0 0;
}
.bank-estimate-avg { color: var(--text-3); }

@media (min-width: 768px) {
    .bank-summary { grid-template-columns: 1fr 1fr 2fr; }
    .bank-estimate { grid-column: auto; }
}

/* ── Sections ────────────────────────────────────────────────────── */
.bank-section { margin-bottom: 1.75rem; }
.bank-section .section-title {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin: 0;
}
.bank-section .section-title svg { width: 1.1rem; height: 1.1rem; color: var(--clay); }
.bank-section-actions { display: flex; gap: 0.5rem; }
.bank-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    border: 1.5px solid var(--border-mid);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-2);
    text-decoration: none;
    background: var(--bg);
}
.bank-link:hover { border-color: var(--clay); color: var(--text); }
.bank-link svg { width: 0.9rem; height: 0.9rem; }
.bank-empty {
    font-size: 0.85rem;
    color: var(--text-3);
    padding: 0.75rem 1rem;
    border: 1px dashed var(--border-mid);
    border-radius: var(--r);
    margin: 0;
}

/* ── Carte contenant ─────────────────────────────────────────────── */
.bank-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border);
    border-left: 4px solid var(--sage);
    border-radius: var(--r);
    padding: 0.75rem 0.875rem;
    box-shadow: var(--shadow-xs);
    animation: cardIn 0.32s cubic-bezier(0.34,1.2,0.64,1) both;
}
.bank-card--freezer { border-left-color: var(--night); }

.bank-card-qty {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 3.25rem;
    line-height: 1.1;
}
.bank-card-ml   { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.bank-card-unit { font-size: 0.7rem; color: var(--text-3); }
.bank-card-initial { font-size: 0.65rem; color: var(--text-3); }

.bank-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.bank-card-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.625rem;
    font-size: 0.78rem;
    color: var(--text-2);
}
.bank-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.625rem;
    font-size: 0.72rem;
    color: var(--text-3);
}
.bank-card-meta span { display: inline-flex; align-items: center; gap: 0.2rem; }
.bank-card-meta svg { width: 0.8rem; height: 0.8rem; }
.bank-card-note { font-style: italic; }

.bank-expiry {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    color: var(--text-3);
}
.bank-expiry svg { width: 0.85rem; height: 0.85rem; }
.bank-expiry--soon    { color: var(--gold); font-weight: 600; }
.bank-expiry--expired { color: #c03c3c; font-weight: 600; }

.bank-card-actions {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    width: 100%;
    justify-content: space-between;
}
.bank-btn-withdraw {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    flex: 1;
    padding: 0.5rem 0.875rem;
    border-radius: 999px;
    background: var(--clay);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.18s;
}
.bank-btn-withdraw:hover { background: var(--clay-dark); }
.bank-btn-withdraw svg { width: 1rem; height: 1rem; }
.bank-btn-thaw {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    flex: 1;
    padding: 0.45rem 0.875rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-mid);
    color: var(--text-2);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.18s, color 0.18s;
}
.bank-btn-thaw:hover { border-color: var(--clay); color: var(--clay); }
.bank-btn-thaw svg { width: 1rem; height: 1rem; }
/* Bouton « Recongeler » : formulaire POST qui doit s'étirer comme les liens */
.bank-card-actions > .inline-form { display: flex; flex: 1; }
.bank-card-actions > .inline-form .bank-btn-thaw { width: 100%; font-family: inherit; cursor: pointer; }

.bank-card-hint {
    flex-basis: 100%;
    color: var(--text-2);
}

/* Cibles tactiles : 44 px minimum sur mobile (usage principal) */
.bank-btn-withdraw,
.bank-btn-thaw { min-height: 2.75rem; }
.bank-card-actions { gap: 0.5rem; }
.bank-card-actions .activity-actions { gap: 0.375rem; }
.bank-card-actions .activity-actions .inline-form { flex: none; }
.bank-card-actions .action-btn,
.bank-card-actions .btn-card-delete {
    flex: none;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bank-card-actions .action-btn { background: var(--surface-mid); border: 1px solid var(--border); color: var(--text-2); }
.bank-card-actions .action-btn svg,
.bank-card-actions .btn-card-delete svg { width: 1.2rem; height: 1.2rem; }
.bank-link { min-height: 2.5rem; }

@media (min-width: 640px) {
    .bank-card { flex-wrap: nowrap; }
    .bank-card-actions { width: auto; }
    .bank-btn-withdraw,
    .bank-btn-thaw,
    .bank-card-actions > .inline-form { flex: none; }
    .bank-btn-withdraw,
    .bank-btn-thaw { min-height: 2.25rem; }
    .bank-card-actions .action-btn,
    .bank-card-actions .btn-card-delete { width: 2.25rem; height: 2.25rem; }
    .bank-card-actions .action-btn svg,
    .bank-card-actions .btn-card-delete svg { width: 1rem; height: 1rem; }
    .bank-link { min-height: 0; }
}

/* ── Historique des sorties ──────────────────────────────────────── */
.bank-history {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
}
/* Mobile : date + quantité sur la 1re ligne, provenance dessous, actions à droite */
.bank-history-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
        "date qty  actions"
        "from from actions";
    align-items: center;
    column-gap: 0.75rem;
    row-gap: 0.1rem;
    padding: 0.5rem 0.75rem 0.5rem 0.875rem;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
}
.bank-history-row:last-child { border-bottom: none; }
.bank-history-date { grid-area: date; color: var(--text-2); }
.bank-history-date::first-letter { text-transform: uppercase; }
.bank-history-qty  { grid-area: qty; font-weight: 600; color: var(--text); }
.bank-history-from {
    grid-area: from;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-3);
}
.bank-history-from svg { width: 0.85rem; height: 0.85rem; }
.bank-history-actions {
    grid-area: actions;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}
.bank-history-actions .inline-form { flex: none; }
.bank-history-actions .action-btn {
    width: 2.75rem;
    height: 2.75rem;
    background: var(--surface-mid);
    border: 1px solid var(--border);
    color: var(--text-2);
}
.bank-history-actions .action-btn svg { width: 1.2rem; height: 1.2rem; }
.bank-history-refreeze {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-height: 2.75rem;
    padding: 0 0.875rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-mid);
    color: var(--night);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.18s;
}
.bank-history-refreeze:hover { border-color: var(--night); }
.bank-history-refreeze svg { width: 1rem; height: 1rem; }
[data-theme="dark"] .bank-history-refreeze { color: #9fb2dd; }

@media (min-width: 640px) {
    .bank-history-row {
        grid-template-columns: 5.5rem 4rem 1fr auto;
        grid-template-areas: "date qty from actions";
    }
    .bank-history-actions .action-btn,
    .bank-history-refreeze { width: auto; min-width: 2.25rem; height: 2.25rem; min-height: 2.25rem; }
}

/* ── Choix frigo / congélateur ───────────────────────────────────── */
.storage-choice {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(5rem, 1fr));
    gap: 0.625rem;
}
.storage-choice-option { display: flex; flex-direction: column; }
.storage-choice-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.75rem 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border-mid);
    border-radius: var(--r);
    color: var(--text-2);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.storage-choice-card svg { width: 1.4rem; height: 1.4rem; }
.visually-hidden-input:checked + .storage-choice-card {
    border: 2px solid var(--clay);
    background: rgba(196, 120, 90, 0.08);
    color: var(--clay-dark);
    font-weight: 600;
}
.visually-hidden-input:focus-visible + .storage-choice-card {
    outline: 2px solid var(--clay);
    outline-offset: 2px;
}

/* ── Formulaires ─────────────────────────────────────────────────── */
.form-hint {
    font-size: 0.78rem;
    color: var(--text-3);
    margin: -0.5rem 0 0;
}
.bank-quick-qty { margin-top: -0.5rem; }

.bank-freeze-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}
.bank-freeze-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    background: var(--surface);
    border: 1px solid var(--border-mid);
    border-radius: var(--r-sm);
    cursor: pointer;
}
.bank-freeze-item:has(input:checked) {
    border-color: var(--clay);
    background: rgba(196, 120, 90, 0.06);
}
.bank-freeze-qty  { font-weight: 600; color: var(--text); min-width: 4rem; }
.bank-freeze-date { font-size: 0.78rem; color: var(--text-3); }
.bank-freeze-total {
    font-size: 0.95rem;
    color: var(--text-2);
    margin: 0;
}

/* ── Dark mode ───────────────────────────────────────────────────── */
[data-theme="dark"] .bank-stock--freezer .bank-stock-icon { background: rgba(130,150,200,0.15); color: #9fb2dd; }
[data-theme="dark"] .bank-card--freezer { border-left-color: #9fb2dd; }
[data-theme="dark"] .visually-hidden-input:checked + .storage-choice-card { color: var(--clay-light); }
[data-theme="dark"] .bank-expiry--expired { color: #f08a8a; }

/* ── Ligne quantité / nombre (formulaire d'ajout) ────────────────── */
.bank-form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    align-items: start;
}
.bank-form-row .form-field { min-width: 0; }
.bank-form-row .field-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
