/* ==========================================================================
   RT106 — Vente de vins : styles communs + bon de commande (mobile & PC)
   ========================================================================== */

:root {
    --green-950: #06180f;
    --green-900: #0a2a1e;
    --green-800: #0d3b2c;
    --green-700: #145a41;
    --green-600: #1c7a55;
    --green-500: #2f9a6c;
    --green-100: #dff0e7;
    --green-50: #f1f8f4;
    --accent: #f29f1f;
    --accent-600: #dc8a0c;
    --accent-50: #fff4e1;
    --red: #c0392b;
    --red-50: #fdecea;
    --orange: #d9730d;
    --orange-50: #fdf0e1;
    --blue: #2563a8;
    --blue-50: #e8f0fa;
    --bg: #f5f4ef;
    --surface: #ffffff;
    --text: #1b2420;
    --muted: #67736d;
    --border: #e2e0d8;
    --border-strong: #cfcdc3;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow-sm: 0 1px 2px rgba(10, 42, 30, .06);
    --shadow: 0 4px 18px rgba(10, 42, 30, .08);
    --shadow-lg: 0 12px 40px rgba(10, 42, 30, .16);
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-display: "Playfair Display", Georgia, serif;
    --header-h: 60px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.45;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; font-weight: 700; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .6em; }
a { color: var(--green-700); }
code { background: var(--green-50); padding: 1px 5px; border-radius: 5px; font-size: .9em; }
kbd { border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: .85em; background: #fff; }
button { font: inherit; color: inherit; }

.muted { color: var(--muted); }
.small { font-size: .85em; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.text-red { color: var(--red); }
.text-green { color: var(--green-600); }
.text-orange { color: var(--orange); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-gap { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.print-only { display: none; }

/* ---------- Splash & spinner ---------- */
.splash {
    position: fixed; inset: 0; display: flex; flex-direction: column; gap: 22px;
    align-items: center; justify-content: center; background: var(--bg); z-index: 50;
}
.splash img { width: 96px; height: 96px; object-fit: contain; }
.splash.inline { position: static; padding: 60px 0; background: transparent; }
.spinner {
    width: 34px; height: 34px; border-radius: 50%;
    border: 3px solid var(--green-100); border-top-color: var(--green-600);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45em;
    min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
    font-weight: 600; font-size: .95rem; text-decoration: none; cursor: pointer; white-space: nowrap;
    transition: background .15s, box-shadow .15s, transform .05s, border-color .15s;
    user-select: none;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--green-700); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--green-800); }
.btn-accent { background: var(--accent); color: #231400; box-shadow: 0 4px 14px rgba(242, 159, 31, .35); }
.btn-accent:hover:not(:disabled) { background: var(--accent-600); }
.btn-secondary { background: #fff; color: var(--green-800); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { border-color: var(--green-600); background: var(--green-50); }
.btn-ghost { background: transparent; color: var(--green-800); }
.btn-ghost:hover:not(:disabled) { background: var(--green-50); }
.btn-danger { background: var(--red); color: #fff; }
.btn-lg { min-height: 52px; padding: 0 22px; font-size: 1.02rem; border-radius: 13px; }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: .85rem; border-radius: 8px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; color: var(--green-700); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn.danger { color: var(--red); }
.icon-btn {
    width: 28px; height: 28px; border-radius: 7px; border: 0; background: transparent;
    color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem;
}
.icon-btn:hover:not(:disabled) { background: var(--red-50); color: var(--red); }
.icon-btn:disabled { opacity: .3; cursor: default; }

/* ---------- Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > span { font-size: .84rem; font-weight: 600; color: #3d4843; }
.field em { color: var(--red); font-style: normal; }
.input {
    width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 10px;
    border: 1px solid var(--border-strong); background: #fff; font: inherit; color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(28, 122, 85, .18); }
.input.invalid { border-color: var(--red); background: #fffafa; }
.input:disabled { background: #f3f2ee; color: var(--muted); }
.input-lg { min-height: 50px; font-size: 16px; border-radius: 12px; }
textarea.input { resize: vertical; }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2367736d' stroke-width='1.6' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.error-text { color: var(--red); font-size: .84rem; font-weight: 500; }
.check-row { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .92rem; }
.check-row input { width: 17px; height: 17px; accent-color: var(--green-700); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

.switch-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 16px; margin: 6px 0 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; cursor: pointer;
}
.switch-row span { display: flex; flex-direction: column; }
.switch { appearance: none; width: 50px; height: 30px; border-radius: 30px; background: #d5d3cb; position: relative; cursor: pointer; transition: background .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch:checked { background: var(--green-600); }
.switch:checked::after { transform: translateX(20px); }

.search-box { position: relative; flex: 1; min-width: 200px; }
.search-box .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: .85rem; opacity: .6; pointer-events: none; }
.search-box .input { padding-left: 36px; }
.search-box.sm { min-width: 160px; }
.search-box.sm .input { min-height: 34px; }

/* ---------- Pastilles, badges, alertes ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 20px; font-size: .76rem; font-weight: 600; white-space: nowrap; }
.pill-lg { padding: 6px 13px; font-size: .85rem; }
.pill-green { background: var(--green-100); color: var(--green-700); }
.pill-red { background: var(--red-50); color: var(--red); }
.pill-orange { background: var(--orange-50); color: var(--orange); }
.pill-blue { background: var(--blue-50); color: var(--blue); }
.pill-grey { background: #ecebe6; color: #7b817e; }
.pill-light { background: #f0efea; color: #4c5550; }

.badge {
    display: inline-block; padding: 2px 8px; border-radius: 6px; margin-bottom: 5px;
    background: var(--accent-50); color: #8a5300; font-size: .72rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
}
.badge.sm { margin: 0 0 0 6px; font-size: .64rem; padding: 1px 6px; vertical-align: 1px; }

.alert { display: block; padding: 11px 15px; border-radius: 10px; margin-bottom: 12px; font-weight: 500; text-decoration: none; }
.alert-info { background: var(--blue-50); color: #1d4b80; }
.alert-error { background: var(--red-50); color: #8d241a; }
.alert-success { background: var(--green-100); color: var(--green-800); }
.alert-warn { background: var(--orange-50); color: #8a4a07; }
.hint-box { background: var(--green-50); border: 1px dashed #b9dcc9; color: var(--green-800); padding: 10px 13px; border-radius: 10px; font-size: .9rem; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow-sm); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; }
.card h3 { margin-bottom: .6em; }

.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-state.small { padding: 30px 10px; }
.empty-icon { font-size: 2.6rem; margin-bottom: 8px; }
.danger-zone { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--border-strong); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.grid-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.grid-table th, .grid-table td { padding: 8px 10px; border-bottom: 1px solid #eeede7; text-align: left; vertical-align: middle; }
.grid-table th.num, .grid-table td.num { text-align: right; }
.grid-table thead th { background: #faf9f5; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; white-space: nowrap; }
.grid-table tfoot th, .grid-table tfoot td { background: #faf9f5; font-weight: 700; border-bottom: 0; }
.grid-table.hover tbody tr:hover { background: var(--green-50); }
.grid-table .group-row th { background: var(--green-800); color: #fff; font-size: .82rem; letter-spacing: .02em; padding: 7px 10px; text-transform: none; }
.grid-table tr.selected { background: #fbf6e8; }
.grid-table tr.cancelled td { color: #a3a8a5; text-decoration: line-through; }
.grid-table tr.cancelled td .pill { text-decoration: none; }
.grid-table tr.unavailable td { color: #9aa09d; }
.grid-table tr.clickable { cursor: pointer; }
.grid-table .actions { text-align: right; white-space: nowrap; }
.grid-table.compact th, .grid-table.compact td { padding: 5px 8px; }
.sticky-head thead th { position: sticky; top: 0; z-index: 2; }

.qty-input {
    width: 76px; height: 34px; text-align: center; font: inherit; font-weight: 700; font-size: 1rem;
    border: 1px solid var(--border-strong); border-radius: 8px; background: #fff;
}
.qty-input:focus { outline: none; border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(28, 122, 85, .18); background: #fffdf5; }
tr.selected .qty-input { border-color: var(--accent); background: var(--accent-50); }
.qty-input::-webkit-inner-spin-button { opacity: .4; }

/* ---------- Écrans d'accès (code, choix du tabler) ---------- */
.gate { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px 16px 40px; background: radial-gradient(circle at 20% 0%, #1c6b4a 0%, var(--green-900) 60%); }
.gate-hero { width: 100%; max-width: 560px; margin-bottom: 16px; }
.gate-hero img { width: 100%; border-radius: 16px; box-shadow: var(--shadow-lg); display: block; }
.gate-card { position: relative; width: 100%; max-width: 440px; background: var(--surface); border-radius: 20px; padding: 28px 22px 22px; box-shadow: var(--shadow-lg); text-align: center; }
.gate-card .field { text-align: left; }
.gate-card-wide { max-width: 560px; }
.gate-card h1 { font-family: var(--font-display); font-size: 1.6rem; color: var(--green-800); }
.logo-lg { width: 120px; height: 120px; object-fit: contain; }
.logo-md { width: 76px; height: 76px; object-fit: contain; margin-top: -4px; }
.tabler-list { display: grid; grid-template-columns: 1fr; gap: 6px; margin-top: 12px; max-height: 55vh; overflow: auto; text-align: left; padding: 2px; }
.tabler-option { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: #fff; cursor: pointer; font-weight: 600; min-height: 54px; }
.tabler-option:hover, .tabler-option:focus-visible { border-color: var(--green-600); background: var(--green-50); outline: none; }
@media (min-width: 600px) { .tabler-list { grid-template-columns: 1fr 1fr; } }
.avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--green-100); color: var(--green-800); display: inline-flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 800; }
.avatar.sm { width: 28px; height: 28px; font-size: .68rem; background: rgba(255,255,255,.18); color: #fff; }
.center-card { max-width: 420px; margin: 80px auto; text-align: center; padding: 20px; }

/* ---------- En-tête public ---------- */
.pub-header {
    position: sticky; top: 0; z-index: 30; height: var(--header-h);
    display: flex; align-items: center; gap: 14px; padding: 0 14px;
    background: linear-gradient(90deg, var(--green-900), var(--green-800)); color: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,.18);
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
.brand img { width: 42px; height: 42px; object-fit: contain; background: #fff; border-radius: 50%; padding: 2px; flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-family: var(--font-display); font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { font-size: .72rem; opacity: .75; }
.pub-nav { display: flex; gap: 4px; margin-left: 18px; }
.pub-nav a { color: rgba(255,255,255,.8); text-decoration: none; padding: 8px 14px; border-radius: 9px; font-weight: 600; font-size: .92rem; }
.pub-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.pub-nav a.active { background: rgba(255,255,255,.14); color: #fff; }
.tabler-chip { margin-left: auto; display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); color: #fff; border-radius: 30px; padding: 4px 12px 4px 4px; cursor: pointer; max-width: 46vw; }
.tabler-chip-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .85rem; font-weight: 600; }
@media (max-width: 520px) {
    .brand-text small { display: none; }
    .tabler-chip { padding-right: 4px; }
    .tabler-chip-name { display: none; }
}
.closed-banner { background: var(--accent-50); color: #7a4700; text-align: center; padding: 8px; font-weight: 600; font-size: .9rem; }
.pub-main { padding: 16px 14px 40px; max-width: 720px; margin: 0 auto; }
.is-desktop .pub-main { max-width: 1680px; padding: 22px 26px 50px; }
.pub-footer { text-align: center; padding: 10px 0 30px; }
.is-mobile .pub-footer { padding-bottom: calc(110px + var(--safe-bottom)); }
.toast-banner { display: flex; justify-content: space-between; gap: 10px; align-items: center; background: var(--accent-50); color: #6e4200; border-radius: 10px; padding: 9px 13px; margin-bottom: 12px; font-size: .9rem; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }

/* ---------- Accueil ---------- */
.hero img { width: 100%; display: block; border-radius: var(--radius); box-shadow: var(--shadow); }
.home-greeting { margin: 18px 2px 12px; }
.home-greeting h1 { font-family: var(--font-display); color: var(--green-800); margin-bottom: 2px; }
.home-actions { display: grid; gap: 10px; margin-bottom: 14px; }
.action-card { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .1s; }
.action-card:hover { box-shadow: var(--shadow); }
.action-card:active { transform: scale(.99); }
.action-card.primary { background: linear-gradient(120deg, var(--green-700), var(--green-800)); color: #fff; border: 0; }
.action-card.primary small { color: rgba(255,255,255,.75); }
.action-icon { width: 48px; height: 48px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; border-radius: 12px; background: var(--green-50); }
.action-card.primary .action-icon { background: rgba(255,255,255,.14); }
.action-text { display: flex; flex-direction: column; flex: 1; }
.action-text strong { font-size: 1.05rem; }
.action-text small { color: var(--muted); }
.chevron { font-size: 1.6rem; opacity: .5; line-height: 1; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; }
.stat-value { font-size: 1.2rem; font-weight: 800; color: var(--green-800); font-variant-numeric: tabular-nums; }
.stat-label { font-size: .78rem; color: var(--muted); }
.stat-warn .stat-value { color: var(--orange); }
.draft-banner { display: block; padding: 12px 14px; margin-bottom: 14px; border-radius: 12px; background: var(--accent-50); color: #6e4200; text-decoration: none; }
.info-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.home-desktop { display: grid; grid-template-columns: 1.3fr 1fr; gap: 0 28px; max-width: 1200px; margin: 0 auto; }
.home-desktop .hero { grid-column: 1 / -1; }
.home-desktop .stat-grid { grid-template-columns: repeat(4, 1fr); grid-column: 1 / -1; }
.home-desktop .draft-banner, .home-desktop .info-card { grid-column: 1 / -1; }

/* ==========================================================================
   Bon de commande MOBILE
   ========================================================================== */
.m-order { padding-bottom: 20px; }
.m-steps {
    position: sticky; top: var(--header-h); z-index: 20; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
    margin: -16px -14px 14px; padding: 10px 14px; background: rgba(245, 244, 239, .94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.m-step { display: flex; align-items: center; justify-content: center; gap: 7px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; }
.m-step-num { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .78rem; background: #e6e4dc; color: var(--muted); }
.m-step.active { background: var(--surface); color: var(--green-800); box-shadow: var(--shadow-sm); }
.m-step.active .m-step-num { background: var(--green-700); color: #fff; }
.m-step.done .m-step-num { background: var(--green-100); color: var(--green-700); }
.m-order-head { font-weight: 700; color: var(--green-800); margin-bottom: 8px; }
.m-title { font-family: var(--font-display); font-size: 1.45rem; color: var(--green-800); margin: 4px 0 14px; }

.m-wine-tools { position: sticky; top: calc(var(--header-h) + 61px); z-index: 15; margin: -14px -14px 6px; padding: 8px 14px 6px; background: rgba(245, 244, 239, .96); backdrop-filter: blur(10px); }
.m-wine-tools .input { min-height: 44px; font-size: 16px; border-radius: 12px; }
.chips { display: flex; gap: 7px; overflow-x: auto; padding: 9px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 34px; padding: 0 13px; border-radius: 30px; border: 1px solid var(--border-strong); background: #fff; font-size: .85rem; font-weight: 600; white-space: nowrap; cursor: pointer; color: var(--green-800); }
.chip.active { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.chip-count { display: inline-block; min-width: 20px; padding: 0 5px; margin-left: 3px; border-radius: 10px; background: var(--accent); color: #231400; font-size: .72rem; }

.m-producer { margin-top: 16px; scroll-margin-top: 180px; }
.m-producer-title { font-family: var(--font-display); font-size: 1.12rem; color: var(--green-800); padding: 4px 2px 8px; margin: 0; border-bottom: 2px solid var(--green-100); margin-bottom: 8px; }
.m-wine { display: flex; gap: 10px; align-items: center; justify-content: space-between; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 12px 13px 14px; margin-bottom: 8px; box-shadow: var(--shadow-sm); transition: border-color .15s, background .15s; }
.m-wine.selected { border-color: var(--accent); background: linear-gradient(0deg, #fffaf0, #fff); box-shadow: 0 0 0 1px var(--accent) inset, var(--shadow-sm); }
.m-wine-info { min-width: 0; flex: 1; }
.m-wine-info h4 { font-size: .98rem; font-weight: 650; margin: 0 0 3px; }
.m-wine-meta { display: flex; flex-wrap: wrap; gap: 3px 9px; margin: 0 0 3px; color: var(--muted); font-size: .8rem; }
.m-wine-meta .vintage { font-weight: 700; color: var(--green-700); }
.m-wine-case { margin: 0; font-size: .9rem; }
.m-wine-action { display: flex; flex-direction: column; align-items: center; gap: 5px; flex: none; }
.m-line-total { font-size: .78rem; font-weight: 700; color: var(--accent-600); }

.stepper { display: flex; align-items: center; background: #f2f1ec; border-radius: 30px; padding: 3px; }
.stepper-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: #fff; color: var(--green-800); font-size: 1.4rem; font-weight: 500; line-height: 1; cursor: pointer; box-shadow: var(--shadow-sm); touch-action: manipulation; }
.stepper-btn.plus { background: var(--green-700); color: #fff; }
.stepper-btn:disabled { opacity: .35; cursor: default; box-shadow: none; }
.stepper-btn:active:not(:disabled) { transform: scale(.92); }
.stepper-value { min-width: 34px; text-align: center; font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.stepper:not(.has-value) .stepper-value { color: #b1b5b3; }
.stepper.has-value { background: var(--accent-50); }

.recap-client { font-size: 1.05rem; margin-bottom: 2px; }
.recap-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #efeee9; }
.recap-line-info { display: flex; flex-direction: column; min-width: 0; }
.recap-line-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.recap-line .stepper-btn { width: 32px; height: 32px; font-size: 1.1rem; }
.recap-line-total { font-weight: 700; font-size: .88rem; }
.recap-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 12px; }
.recap-total strong { font-size: 1.3rem; color: var(--green-800); }
.pay-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.pay-option { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 11px 12px; text-align: left; border: 1.5px solid var(--border); border-radius: 12px; background: #fff; cursor: pointer; }
.pay-option small { color: var(--muted); font-size: .74rem; }
.pay-icon { font-size: 1.3rem; }
.pay-option.active { border-color: var(--green-600); background: var(--green-50); box-shadow: 0 0 0 1px var(--green-600) inset; }

.m-bottom-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 14px calc(10px + var(--safe-bottom));
    background: rgba(255,255,255,.97); backdrop-filter: blur(12px); border-top: 1px solid var(--border); box-shadow: 0 -6px 24px rgba(10, 42, 30, .1);
}
.m-total { display: flex; flex-direction: column; line-height: 1.15; }
.m-total strong { font-size: 1.3rem; color: var(--green-800); font-variant-numeric: tabular-nums; }
.m-total small { color: var(--muted); }
.m-bottom-bar .btn { flex: 1; max-width: 250px; }

/* Confirmation */
.done { text-align: center; max-width: 520px; margin: 0 auto; }
.done-check { width: 74px; height: 74px; margin: 10px auto 14px; border-radius: 50%; background: var(--green-600); color: #fff; font-size: 2.3rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 24px rgba(28, 122, 85, .35); animation: pop .4s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
.done h1 { font-family: var(--font-display); color: var(--green-800); }
.done-summary { text-align: left; margin: 18px 0 12px; }
.done-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid #efeee9; }
.done-row:last-child { border-bottom: 0; }
.done-row span { color: var(--muted); }
.done-row .big { font-size: 1.25rem; color: var(--green-800); }
.done .hint-box { text-align: left; }
.done-actions { display: grid; gap: 8px; margin: 16px 0; }
.done-next { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; padding-top: 6px; }
.done-desktop { max-width: 640px; }

/* Mes commandes */
.my-orders .stat-grid { margin-top: 4px; }
.my-orders .search-box { margin-bottom: 12px; }
.my-orders-desktop .stat-grid { grid-template-columns: repeat(4, 1fr); }
.order-cards { display: grid; gap: 8px; }
.order-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm); }
.order-card.cancelled { opacity: .55; }
.order-card-top, .order-card-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.order-num { font-size: .8rem; font-weight: 700; color: var(--muted); }
.order-client { display: block; font-size: 1.05rem; margin: 3px 0; }
.order-amount { font-weight: 800; color: var(--green-800); }
.order-card-pay { margin-top: 6px; }

/* ==========================================================================
   Bon de commande PC
   ========================================================================== */
.d-order { display: grid; grid-template-columns: 330px minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); margin-bottom: 16px; }
.panel.sticky { position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100vh - var(--header-h) - 32px); overflow: auto; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }
.d-client .panel-head { flex-direction: column; gap: 2px; }
.d-client h2 { font-family: var(--font-display); color: var(--green-800); font-size: 1.35rem; }
.d-fields .field { margin-bottom: 10px; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); background: #f1f0eb; border-radius: 10px; padding: 3px; gap: 3px; }
.seg-btn { border: 0; background: transparent; border-radius: 8px; padding: 7px 4px; font-size: .82rem; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg-btn.active { background: #fff; color: var(--green-800); box-shadow: var(--shadow-sm); }
.d-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.d-toolbar .select { width: auto; min-width: 220px; }
.kbd-hint { margin: 0 0 8px; }
.order-grid .wine-name { font-weight: 550; }
.order-grid td { padding-top: 6px; padding-bottom: 6px; }
.order-grid td.num { white-space: nowrap; }
.order-grid .qty-col { width: 96px; text-align: center; }
.order-grid thead th { position: sticky; top: 0; z-index: 2; }
.d-catalog .table-wrap { max-height: none; overflow: visible; }
.recap-panel h2 { font-family: var(--font-display); color: var(--green-800); }
.recap-list { list-style: none; margin: 0 0 12px; padding: 0; }
.recap-list li { display: grid; grid-template-columns: auto 1fr auto auto; gap: 6px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid #f0efea; font-size: .88rem; }
.recap-qty { font-weight: 800; color: var(--accent-600); }
.recap-amount { font-weight: 600; font-variant-numeric: tabular-nums; }
.recap-sum { background: var(--green-50); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; }
.recap-sum div { display: flex; justify-content: space-between; padding: 3px 0; }
.recap-grand { border-top: 1px solid #c7e2d4; margin-top: 4px; padding-top: 8px !important; }
.recap-grand strong { font-size: 1.45rem; color: var(--green-800); }
.error-list { margin: 0 0 12px; padding: 10px 12px 10px 28px; background: var(--red-50); color: #8d241a; border-radius: 10px; font-size: .87rem; }

@media (max-width: 1280px) {
    .d-order { grid-template-columns: 300px minmax(0, 1fr); }
    .d-recap { grid-column: 1 / -1; }
    .d-recap .panel.sticky { position: static; max-height: none; }
}

/* ---------- Bon de commande imprimable ---------- */
.sheet-page { background: #e9e8e2; min-height: 100vh; padding: 20px 10px 60px; }
.sheet-toolbar { max-width: 800px; margin: 0 auto 12px; display: flex; justify-content: flex-end; }
.sheet { background: #fff; max-width: 800px; margin: 0 auto 24px; padding: 34px 38px; box-shadow: var(--shadow); border-radius: 4px; font-size: 13px; color: #111; }
.sheet-head { display: flex; align-items: center; gap: 16px; border-bottom: 3px solid var(--green-800); padding-bottom: 14px; margin-bottom: 16px; }
.sheet-head img { width: 64px; height: 64px; object-fit: contain; }
.sheet-head h1 { font-family: var(--font-display); color: var(--green-800); font-size: 1.5rem; margin: 0; }
.sheet-head p { margin: 0; color: #555; }
.sheet-num { margin-left: auto; text-align: right; display: flex; flex-direction: column; }
.sheet-num span { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #666; }
.sheet-num strong { font-size: 1.4rem; color: var(--green-800); }
.sheet-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 18px; }
.sheet-parties h2 { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #666; margin-bottom: 4px; }
.sheet-parties p { margin: 0; }
.sheet-table { width: 100%; border-collapse: collapse; }
.sheet-table th { background: var(--green-800); color: #fff; padding: 6px 8px; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; text-align: left; }
.sheet-table td { padding: 5px 8px; border-bottom: 1px solid #e6e6e6; }
.sheet-table .num { text-align: right; }
.sheet-group td { background: #eef5f1; font-weight: 700; color: var(--green-800); }
.sheet-table tfoot td { border-bottom: 0; padding-top: 6px; }
.sheet-total td { font-weight: 800; font-size: 1.05em; border-top: 2px solid var(--green-800); }
.sheet-foot { margin-top: 18px; padding-top: 12px; border-top: 1px solid #ddd; color: #333; }
.sheet-paid { color: var(--green-700); font-weight: 700; }
.sheet-thanks { font-family: var(--font-display); color: var(--green-800); font-size: 1.05rem; margin-top: 10px; }

/* ---------- Reconnexion Blazor ---------- */
#components-reconnect-modal { display: none; }
#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex; position: fixed; inset: 0; z-index: 1000; align-items: flex-start; justify-content: center; padding-top: 90px; background: rgba(6, 24, 15, .35); backdrop-filter: blur(2px);
}
.reconnect-card { background: #fff; border-radius: 16px; padding: 20px 26px; box-shadow: var(--shadow-lg); text-align: center; max-width: 320px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.reconnect-card p { display: none; margin: 0; }
.components-reconnect-show .reconnect-card .show,
.components-reconnect-failed .reconnect-card .failed,
.components-reconnect-rejected .reconnect-card .rejected { display: block; }
.components-reconnect-failed .spinner, .components-reconnect-rejected .spinner { display: none; }

#blazor-error-ui { background: #fff3cd; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); display: none; left: 0; padding: .7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 1rem; top: .6rem; }
.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; }
.blazor-error-boundary::after { content: "Une erreur est survenue." }

/* ---------- Impression ---------- */
@page { size: A4; margin: 12mm; }
@media print {
    body { background: #fff; font-size: 12px; }
    .no-print, .sheet-toolbar, .pub-header, .pub-footer, #blazor-error-ui, #components-reconnect-modal { display: none !important; }
    .print-only { display: revert !important; }
    .sheet-page { background: #fff; padding: 0; min-height: 0; }
    .sheet { box-shadow: none; margin: 0; padding: 0; max-width: none; border-radius: 0; }
    .sheet-page-break { break-after: page; }
    .sheet-page-break:last-child { break-after: auto; }
    .sheet-group td, .sheet-table th, .grid-table .group-row th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
