/* ==========================================================================
   The quote page (templates/admin/quote/editor.html.twig): its lines on the
   left, what its event says on the right; one column on a narrow screen.
   ========================================================================== */
.qe {
    --qe-bg: var(--body-bg, #ffffff);
    --qe-soft: #f9fafb;
    --qe-border: var(--border-color, #e5e7eb);
    --qe-text: var(--text-color, #111827);
    --qe-muted: #6b7280;
    --qe-accent: #4f46e5;
    --qe-accent-soft: #eef2ff;
    color: var(--qe-text);
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.ea-dark-scheme .qe {
    --qe-soft: rgba(255, 255, 255, 0.04);
    --qe-muted: #9ca3af;
    --qe-accent: #818cf8;
    --qe-accent-soft: rgba(129, 140, 248, 0.15);
}

.qe-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.qe-back { font-size: 0.85rem; text-decoration: none; color: var(--qe-muted); }
.qe-back:hover { color: var(--qe-accent); }
.qe-title { font-size: 1.35rem; margin: 4px 0 0; display: flex; align-items: center; gap: 10px; }
.qe-badge { font-size: 0.72rem; font-weight: 700; border-radius: 999px; padding: 2px 9px; background: var(--qe-soft); border: 1px solid var(--qe-border); color: var(--qe-muted); }
.qe-head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.qe-head-actions form { margin: 0; }
.qe-saved { font-size: 0.8rem; color: var(--qe-muted); margin-right: 4px; }
.qe-saved-error { color: #b91c1c; font-weight: 600; }
.qe-problems ul { margin: 4px 0 0; padding-left: 18px; }
.qe-problems, .qe-error { margin: 0; }

.qe-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 1150px) { .qe-body { grid-template-columns: minmax(0, 1fr); } }

.qe-quote { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.qe-table-wrap { overflow-x: auto; border: 1px solid var(--qe-border); border-radius: 10px; }
.qe-lines { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.qe-lines th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--qe-muted); padding: 8px 6px; border-bottom: 1px solid var(--qe-border); background: var(--qe-soft); white-space: nowrap; }
.qe-lines td { padding: 8px 6px; border-bottom: 1px solid var(--qe-border); vertical-align: top; }
.qe-lines tr:last-child td { border-bottom: 0; }
.qe-lines .qe-num, .qe-lines th.qe-num { text-align: right; }
.qe-lines input.qe-num { min-width: 70px; }
.qe-lines .qe-vat { width: 64px; }
.qe-unit-cell select { min-width: 112px; }
.qe-handle { cursor: grab; color: var(--qe-muted); width: 20px; padding-top: 14px !important; }
.qe-what { min-width: 200px; }
/* One field the customer reads; its product, its description and discount below, small */
.qe-what-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 4px; }
.qe-what-meta .qe-product { width: auto; max-width: 220px; font-size: 0.75rem; padding-top: 2px; padding-bottom: 2px; color: var(--qe-muted); }
.qe-toggle { border: 0; background: none; padding: 0; font-size: 0.78rem; color: var(--qe-accent); cursor: pointer; }
.qe-toggle:hover { text-decoration: underline; }
.qe-part { margin-top: 4px; font-size: 0.8rem; }
.qe-discount { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.qe-discount label { display: flex; align-items: center; gap: 6px; margin: 0; }
.qe-discount input { width: 80px; }
.qe-discount select { width: 64px; }
.qe-qty { min-width: 96px; max-width: 160px; }
.qe-total { white-space: nowrap; font-weight: 600; padding-top: 14px !important; }
/* Its quantities at a click, on one row (scrolled within the cell when they do not fit) */
.qe-chips { display: flex; flex-wrap: nowrap; gap: 4px; margin-top: 4px; max-width: 150px; margin-left: auto; overflow-x: auto; scrollbar-width: thin; }
/* Priced per guest, left at 1 */
.qe-lines input.qe-check { border-color: #f59e0b; background: #fffbeb; }
.qe-hint { font-size: 0.72rem; color: #b45309; font-weight: 600; text-align: right; margin-top: 2px; }
.qe-chip { font-size: 0.7rem; border: 1px solid var(--qe-border); background: var(--qe-bg); color: var(--qe-muted); border-radius: 999px; padding: 1px 7px; cursor: pointer; white-space: nowrap; }
.qe-chip:hover { border-color: var(--qe-accent); color: var(--qe-accent); }
.qe-remove { border: 0; background: none; color: var(--qe-muted); cursor: pointer; padding: 8px 6px; }
.qe-remove:hover { color: #b91c1c; }
.qe-lines .is-invalid { border-color: #dc2626; }
.qe-lines .sortable-ghost { opacity: 0.4; }

.qe-empty { color: var(--qe-muted); margin: 0; }
.qe-add { display: flex; flex-wrap: wrap; gap: 8px; }
.qe-add select { max-width: 360px; }

.qe-foot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); gap: 16px; align-items: start; }
@media (max-width: 700px) { .qe-foot { grid-template-columns: minmax(0, 1fr); } }
.qe-settings { display: flex; flex-direction: column; gap: 10px; font-size: 0.85rem; }
.qe-settings label { display: flex; flex-direction: column; gap: 4px; margin: 0; color: var(--qe-muted); font-weight: 600; }
.qe-settings input[type="date"] { max-width: 180px; }
.qe-pair { display: flex; align-items: center; gap: 6px; }
.qe-pair input { width: 90px; }
.qe-pair select { width: auto; }
.qe-unit { color: var(--qe-muted); }
.qe-help { font-weight: 400; font-size: 0.78rem; color: var(--qe-muted); line-height: 1.35; }

/* "Ligne retirée · Annuler" */
.qe-undo { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 8px 12px; border-radius: 8px; background: #1f2937; color: #fff; font-size: 0.86rem; position: sticky; top: 8px; z-index: 20; }
.qe-undo[hidden] { display: none; }

/* Its trip worked out here */
.qe-travel-options { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 8px; }
.qe-travel-options[hidden] { display: none; }

/* What its event says: beside the quote on a large screen, first and folded otherwise */
.qe-request-top { display: none; }
.qe-request-top summary { cursor: pointer; font-weight: 600; font-size: 0.86rem; }
.qe-request-top[open] summary { margin-bottom: 8px; }
@media (max-width: 1150px) {
    .qe-request-top { display: block; }
    .qe-request-side { display: none; }
}

/* A phone: its total, its preview and sending always in reach */
.qe-sticky { display: none; }
@media (max-width: 700px) {
    .qe-sticky { display: flex; align-items: center; gap: 8px; position: sticky; bottom: 0; z-index: 15; margin: 0 -12px; padding: 10px 12px; background: var(--qe-bg); border-top: 1px solid var(--qe-border); box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06); }
    .qe-sticky-total { flex: 1 1 auto; font-size: 0.86rem; }
    /* The quote being written: its bar below has them (its read page keeps its own) */
    .qe-editor .qe-head-actions .btn, .qe-editor .qe-head-actions form { display: none; }
}

.qe-totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; padding: 12px 14px; border: 1px solid var(--qe-border); border-radius: 10px; background: var(--qe-soft); font-size: 0.88rem; }
.qe-totals dt { font-weight: 400; color: var(--qe-muted); }
.qe-totals dd { margin: 0; text-align: right; white-space: nowrap; }
.qe-totals .qe-strong { font-weight: 700; color: var(--qe-text); }
.qe-totals .qe-big { font-size: 1.05rem; }

.qe-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.qe-card { border: 1px solid var(--qe-border); border-radius: 10px; padding: 12px 14px; font-size: 0.86rem; }
.qe-card h2 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--qe-muted); margin: 0 0 8px; }
.qe-card p { margin: 0 0 6px; }
.qe-facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0 0 6px; }
.qe-facts dt { color: var(--qe-muted); font-weight: 400; }
.qe-facts dd { margin: 0; }
.qe-text { white-space: pre-line; }
.qe-muted { color: var(--qe-muted); }
.qe-history-scroll { max-height: 520px; overflow-y: auto; gap: 0; }

/* A narrow screen, still a table: its columns tighter, nothing scrolled sideways */
@media (max-width: 1100px) {
    .qe-what { min-width: 150px; }
    .qe-unit-cell select { min-width: 86px; }
    .qe-lines input.qe-num { min-width: 52px; }
    .qe-lines td, .qe-lines th { padding-left: 4px; padding-right: 4px; }
    .qe-chips { max-width: 120px; }
}

/* A phone: each line a card, its fields labelled, nothing off the screen */
@media (max-width: 700px) {
    .qe-table-wrap { overflow: visible; }
    .qe-lines thead { display: none; }
    .qe-lines, .qe-lines tbody { display: block; }
    .qe-line { display: grid; grid-template-columns: 22px minmax(0, 1fr) minmax(0, 1fr); gap: 8px 10px; padding: 10px; border-bottom: 1px solid var(--qe-border); }
    .qe-line:last-child { border-bottom: 0; }
    .qe-lines .qe-line td { display: block; border: 0; padding: 0 !important; min-width: 0; }
    .qe-line .qe-handle { grid-row: 1 / span 4; }
    .qe-line .qe-what { grid-column: 2 / 4; min-width: 0; }
    .qe-line td[data-label]::before { content: attr(data-label); display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--qe-muted); margin-bottom: 2px; }
    .qe-line .qe-total { align-self: end; padding-bottom: 6px !important; }
    .qe-line .qe-remove-cell { text-align: right; align-self: end; }
    .qe-line .qe-chips { justify-content: flex-start; max-width: none; margin-left: 0; }
    .qe-unit-cell select, .qe-lines input.qe-num, .qe-lines .qe-vat { width: 100%; min-width: 0; }
}
