/* ════════════════════════════════════════════════════════════════════
   کاریز فروش، پیش‌فاکتور و محصولات — روی theme-vivid.css سوار می‌شود (آخرین stylesheet).
   هر ستون کاریز یک مرحله با رنگ tone خودش است؛ تابلو افقی و هر ستون عمودی اسکرول می‌خورد.
   کلاس‌های حین کشیدن (is-dragging / drop-target / drop-before / drop-end) را js/pipeline.js می‌گذارد.
   ════════════════════════════════════════════════════════════════════ */

.tone-slate { --tone: #64748b; --tone-soft: #eef1f5; }

/* ── شمارنده‌ها و ابزار ── */
.pl-kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.pl-kpis .kpi > div { position: relative; z-index: 1; min-width: 0; }
.pl-kpis .kpi strong small { margin-inline-start: 3px; color: var(--muted); font-size: var(--text-xs); font-weight: 500; }
.pl-kpi-stalled { text-align: start; font: inherit; cursor: pointer; }
.pl-kpi-stalled[aria-pressed="true"] { border-color: var(--tone); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone) 18%, transparent), var(--shadow-card); }
.pl-toolbar { align-items: center; }
.pl-hint { margin-inline-start: auto; color: var(--faint); font-size: var(--text-xs); white-space: nowrap; }
.pl-hint i { margin-inline-end: 4px; }
.pl-alert { display: flex; align-items: center; gap: var(--s-2); }
.pl-alert .btn-close { margin-inline-start: auto; }

/* ── تابلو و ستون‌ها ── */
.pl-board {
    display: flex;
    gap: var(--s-3);
    align-items: flex-start;
    margin-bottom: var(--s-4);
    padding: 2px 2px var(--s-3);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
}
.pl-board::-webkit-scrollbar { height: 10px; }
.pl-board::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: var(--r-pill); border: 2px solid var(--canvas); }

.pl-col {
    flex: 0 0 286px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 190px);
    min-height: 220px;
    scroll-snap-align: start;
    background: color-mix(in srgb, var(--tone) 5%, var(--surface-sunken));
    border: 1px solid color-mix(in srgb, var(--tone) 14%, var(--line));
    border-radius: var(--r-panel);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.pl-col-closed { flex-basis: 250px; background: color-mix(in srgb, var(--tone) 4%, var(--surface-sunken)); }
.pl-col.drop-target {
    border-color: var(--tone);
    background: color-mix(in srgb, var(--tone) 10%, var(--surface-sunken));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone) 18%, transparent);
}

.pl-col-head { position: relative; padding: 13px 12px 10px; border-bottom: 1px solid color-mix(in srgb, var(--tone) 12%, var(--line)); }
.pl-col-head::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    border-radius: var(--r-panel) var(--r-panel) 0 0;
    background: linear-gradient(90deg, var(--tone), color-mix(in srgb, var(--tone) 45%, #fff));
}
.pl-col-title { display: flex; align-items: center; gap: 8px; }
.pl-col-title .dot { flex-shrink: 0; width: 9px; height: 9px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone) 22%, transparent); }
.pl-col-title strong { overflow: hidden; font-size: var(--text-md); font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.pl-count {
    min-width: 22px;
    padding: 0 7px;
    border: 1px solid color-mix(in srgb, var(--tone) 20%, var(--line));
    border-radius: var(--r-pill);
    background: var(--surface);
    color: var(--tone);
    font-size: var(--text-xs);
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}
.pl-add {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    margin-inline-start: auto;
    border: 1px dashed color-mix(in srgb, var(--tone) 40%, var(--line));
    border-radius: 8px;
    background: transparent;
    color: var(--tone);
    font-size: 1.05rem;
    transition: background 0.15s ease, transform 0.15s var(--ease-spring);
}
.pl-add:hover { background: var(--surface); transform: scale(1.08); }
.pl-col-meta { display: flex; justify-content: space-between; align-items: baseline; margin-top: 6px; color: var(--ink-2); font-size: var(--text-sm); font-weight: 650; }
.pl-prob { color: var(--muted); font-size: var(--text-xs); font-weight: 500; }
.pl-col-bar { height: 4px; margin-top: 8px; overflow: hidden; border-radius: var(--r-pill); background: color-mix(in srgb, var(--tone) 12%, var(--surface)); }
.pl-col-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--tone); }

.pl-cards { display: flex; flex: 1; flex-direction: column; gap: 8px; min-height: 80px; padding: 10px; overflow-y: auto; }
.pl-cards::-webkit-scrollbar { width: 6px; }
.pl-cards::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: var(--r-pill); }
.pl-col.drop-end .pl-cards::after { content: ""; display: block; flex-shrink: 0; height: 3px; border-radius: var(--r-pill); background: var(--tone); }
.pl-empty {
    display: grid;
    place-items: center;
    min-height: 70px;
    padding: 10px;
    border: 1.5px dashed color-mix(in srgb, var(--tone) 25%, var(--line));
    border-radius: 10px;
    color: var(--faint);
    font-size: var(--text-xs);
    text-align: center;
}

/* ── کارت معامله ── */
.pl-card {
    position: relative;
    flex-shrink: 0;
    padding: 11px 12px 10px;
    padding-inline-start: 15px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 11px;
    box-shadow: 0 1px 2px rgba(20, 30, 70, 0.05);
    cursor: grab;
    transition: transform 0.18s var(--ease-out), box-shadow 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}
.pl-card::before {
    content: "";
    position: absolute;
    inset-block: 9px;
    inset-inline-start: 0;
    width: 4px;
    border-radius: 4px 0 0 4px;
    background: var(--tone);
}
.pl-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--tone) 35%, var(--line)); box-shadow: var(--shadow-lift); }
.pl-card:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.pl-card:active { cursor: grabbing; }
.pl-card.is-dragging { opacity: 0.35; transform: rotate(-1.5deg) scale(0.98); }
.pl-card.is-moving { opacity: 0.55; pointer-events: none; }
.pl-card.drop-before::after {
    content: "";
    position: absolute;
    top: -6px;
    inset-inline: 4px;
    height: 3px;
    border-radius: var(--r-pill);
    background: var(--tone);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone) 20%, transparent);
}
.pl-card.is-stalled { border-color: color-mix(in srgb, var(--t-orange) 35%, var(--line)); background: linear-gradient(180deg, color-mix(in srgb, var(--t-orange) 6%, #fff), #fff 65%); }
.pl-card.is-won::before { background: var(--t-emerald); }
.pl-card.is-lost { background: color-mix(in srgb, #64748b 3%, #fff); }
.pl-card.is-lost .pl-card-title { color: var(--muted); }

.pl-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.pl-card-title {
    display: -webkit-box;
    overflow: hidden;
    color: var(--ink);
    font-size: var(--text-sm);
    font-weight: 700;
    line-height: 1.55;
    overflow-wrap: anywhere;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.pl-amount {
    flex-shrink: 0;
    padding: 1px 8px;
    border-radius: var(--r-pill);
    background: var(--tone-soft);
    color: color-mix(in srgb, var(--tone) 78%, #000);
    font-size: var(--text-xs);
    font-weight: 800;
    white-space: nowrap;
}
.pl-card-lead { display: flex; align-items: center; gap: 7px; min-width: 0; margin-top: 7px; color: var(--ink-2); font-size: var(--text-xs); }
.pl-card-lead > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-card-reason { margin-top: 6px; color: var(--danger); font-size: var(--text-xs); overflow-wrap: anywhere; }
.pl-card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 9px; }
.pl-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 7px;
    border-radius: var(--r-pill);
    background: var(--surface-sunken);
    color: var(--muted);
    font-size: 0.7rem;
    line-height: 1.7;
    white-space: nowrap;
}
.pl-chip.is-danger { background: var(--danger-soft); color: var(--danger); }
.pl-chip.is-warn { background: var(--t-orange-soft); color: color-mix(in srgb, var(--t-orange) 82%, #000); font-weight: 650; }
.pl-owner { margin-inline-start: auto; }
.pl-owner .avatar { width: 22px; height: 22px; font-size: 0.65rem; }

/* ── علت‌های از دست رفتن ── */
.pl-lost h5 small { font-size: var(--text-xs); }
.pl-lost-row { display: grid; grid-template-columns: minmax(110px, 200px) 1fr 36px; align-items: center; gap: var(--s-3); padding: 5px 0; font-size: var(--text-sm); }
.pl-lost-bar { height: 8px; overflow: hidden; border-radius: var(--r-pill); background: var(--surface-sunken); }
.pl-lost-bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--t-pink), color-mix(in srgb, var(--t-pink) 45%, #fff)); }

/* ── کشوی جزئیات معامله ── */
.deal-drawer { width: min(440px, calc(100vw - 16px)); gap: 14px; }
.deal-drawer-head { display: flex; align-items: flex-start; gap: 12px; }
.deal-drawer-head > div { flex: 1; min-width: 0; }
.deal-drawer-head small { display: block; color: var(--muted); font-size: var(--text-xs); }
.deal-drawer-head strong { display: block; font-size: var(--text-lg); font-weight: 800; line-height: 1.5; overflow-wrap: anywhere; }
.deal-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid color-mix(in srgb, var(--tone) 22%, var(--line));
    border-radius: var(--r-panel);
    background: linear-gradient(135deg, color-mix(in srgb, var(--tone) 14%, #fff), color-mix(in srgb, var(--tone) 4%, #fff));
}
.deal-hero-label { display: block; color: var(--muted); font-size: var(--text-xs); }
.deal-hero strong { color: var(--ink); font-size: 1.5rem; font-weight: 850; }
.deal-hero small { margin-inline-start: 4px; color: var(--muted); }
.deal-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border: 1px solid color-mix(in srgb, var(--tone) 25%, var(--line));
    border-radius: var(--r-pill);
    background: var(--surface);
    color: var(--tone);
    font-size: var(--text-xs);
    font-weight: 750;
    white-space: nowrap;
}
.deal-status-won { color: var(--t-emerald); }
.deal-status-lost { color: #64748b; }
.deal-steps { display: flex; gap: 4px; }
.deal-step {
    position: relative;
    flex: 1;
    min-width: 0;
    padding: 18px 2px 0;
    overflow: hidden;
    border: 0;
    background: none;
    color: var(--faint);
    font-size: 0.68rem;
    line-height: 1.4;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.deal-step > span {
    position: absolute;
    top: 4px;
    inset-inline: 0;
    height: 7px;
    border-radius: var(--r-pill);
    background: var(--surface-sunken);
    transition: background 0.2s ease, transform 0.2s var(--ease-spring);
}
.deal-step:hover:not(:disabled) > span { transform: scaleY(1.4); background: color-mix(in srgb, var(--tone) 45%, var(--surface-sunken)); }
.deal-step.is-reached > span { background: var(--tone); }
.deal-step.is-reached { color: var(--ink-2); }
.deal-step.is-current { color: var(--tone); font-weight: 800; }
.deal-step:disabled { cursor: default; }
.deal-close-actions, .deal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.deal-confirm { display: inline-flex; align-items: center; gap: 6px; color: var(--danger); font-size: var(--text-sm); }
.deal-facts {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 14px;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-panel);
    font-size: var(--text-sm);
}
.deal-facts dt { color: var(--muted); font-weight: 500; white-space: nowrap; }
.deal-facts dt i { margin-inline-end: 5px; color: var(--faint); }
.deal-facts dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.deal-facts dd a.small { margin-inline-start: 6px; }
.deal-desc { margin: 0; padding: 10px 12px; border-radius: var(--r-control); background: var(--surface-sunken); color: var(--ink-2); font-size: var(--text-sm); white-space: pre-line; overflow-wrap: anywhere; }
.deal-section { margin: 4px 0 0; font-size: var(--text-sm); font-weight: 750; }
.deal-section i { margin-inline-end: 6px; color: var(--primary); }
.deal-quotes { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.deal-quotes li { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r-control); font-size: var(--text-sm); }
.deal-quotes li > .num:last-child { margin-inline-start: auto; font-weight: 700; }
.deal-timeline { position: relative; display: grid; gap: 10px; margin: 0; padding: 0; padding-inline-start: 18px; list-style: none; }
.deal-timeline::before { content: ""; position: absolute; top: 6px; bottom: 6px; inset-inline-start: 4px; width: 2px; background: var(--line); }
.deal-timeline li { position: relative; display: flex; flex-direction: column; font-size: var(--text-sm); }
.deal-timeline li::before {
    content: "";
    position: absolute;
    top: 7px;
    inset-inline-start: -18px;
    width: 10px;
    height: 10px;
    border: 2px solid var(--primary);
    border-radius: 50%;
    background: var(--surface);
}
.deal-timeline li:first-child::before { background: var(--primary); }
.deal-timeline small { color: var(--muted); font-size: var(--text-xs); }

/* ── مودال‌ها (فرم معامله، دلیل از دست رفتن، مرحله‌ها) ── */
.deal-modal { background: rgba(15, 23, 42, 0.38); animation: vv-fade 0.18s ease; }
.deal-modal .modal-content { animation: vv-rise 0.25s var(--ease-out); }
.deal-modal .modal-title i { margin-inline-end: 6px; color: var(--primary); }
.stage-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.stage-pick-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    background: var(--surface);
    color: var(--ink-2);
    font-size: var(--text-sm);
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.stage-pick-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tone); }
.stage-pick-item[aria-checked="true"] {
    border-color: var(--tone);
    background: var(--tone-soft);
    color: color-mix(in srgb, var(--tone) 78%, #000);
    font-weight: 700;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone) 15%, transparent);
}
.money-input { position: relative; }
/* ورودی چپ‌به‌راست است (رقم‌ها از چپ)؛ «تومان» سمت راست کادر می‌نشیند */
.money-input .form-control { padding-right: 56px; font-weight: 650; }
.money-unit { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); color: var(--faint); font-size: var(--text-xs); pointer-events: none; }
.money-words { color: var(--t-emerald); }
.lead-picker { position: relative; }
.lead-picker .lead-search { max-width: none; }
.lead-picker-results {
    position: absolute;
    top: calc(100% + 4px);
    z-index: 20;
    inset-inline: 0;
    max-height: 300px;
    padding: 4px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-panel);
    box-shadow: var(--shadow-pop);
}
.lead-picker-results .search-result { width: 100%; border: 0; background: none; text-align: start; }
.lead-picked { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface-sunken); font-weight: 650; }
.lead-picked .btn { margin-inline-start: auto; }

.stage-rows { display: grid; gap: 8px; }
.stage-row {
    display: grid;
    grid-template-columns: 26px minmax(140px, 1fr) auto 92px auto;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-inline-start: 4px solid var(--tone);
    border-radius: var(--r-control);
    background: var(--surface);
}
.stage-row-num { color: var(--faint); font-weight: 700; text-align: center; }
.stage-colors { display: flex; gap: 4px; }
.stage-color { width: 20px; height: 20px; padding: 0; border: 2px solid var(--surface); border-radius: 50%; background: var(--tone); box-shadow: 0 0 0 1px var(--line); }
.stage-color[aria-checked="true"] { box-shadow: 0 0 0 2px var(--tone); }
.stage-prob { display: flex; align-items: center; gap: 4px; }
.stage-prob span { color: var(--muted); }
.stage-row-actions { display: flex; gap: 2px; }
.stage-kind { grid-column: span 2; color: var(--muted); font-size: var(--text-xs); text-align: end; }

@media (max-width: 760px) {
    .pl-hint { display: none; }
    .pl-col { flex-basis: 82vw; max-height: none; }
    .stage-row { grid-template-columns: 22px 1fr auto; }
    .stage-colors { grid-column: 2 / -1; flex-wrap: wrap; }
    .stage-prob { grid-column: 2; }
    .stage-kind { grid-column: 2 / -1; text-align: start; }
}

/* ── محصولات ── */
.product-icon { display: grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px; border-radius: 10px; background: var(--t-teal-soft); color: var(--t-teal); }
.product-table small { display: block; color: var(--muted); font-size: var(--text-xs); }
.product-table tr.is-inactive td { color: var(--faint); }
.product-form h5 { margin-bottom: var(--s-3); }

/* ── پیش‌فاکتور ── */
.quote-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.quote-no { display: inline-grid; place-items: center; min-width: 44px; padding: 2px 8px; border-radius: var(--r-control); background: var(--primary-soft); color: var(--primary) !important; font-weight: 800; }
.quote-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 10px;
    border-radius: var(--r-pill);
    font-size: var(--text-xs);
    font-weight: 700;
    white-space: nowrap;
}
.quote-title .quote-status { font-size: var(--text-sm); }
.quote-status-draft { background: var(--surface-sunken); color: var(--ink-2); }
.quote-status-sent { background: var(--t-sky-soft); color: color-mix(in srgb, var(--t-sky) 80%, #000); }
.quote-status-accepted { background: var(--t-emerald-soft); color: color-mix(in srgb, var(--t-emerald) 80%, #000); }
.quote-status-rejected { background: var(--danger-soft); color: var(--danger); }
.quote-status-expired { background: var(--t-amber-soft); color: color-mix(in srgb, var(--t-amber) 75%, #000); }

.quote-flow { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-5); }
.quote-steps { display: flex; flex: 1 1 360px; gap: 0; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.quote-steps li { position: relative; display: flex; flex: 1; align-items: center; gap: 8px; color: var(--faint); font-size: var(--text-sm); font-weight: 600; }
.quote-steps li:not(:last-child)::after { content: ""; flex: 1; height: 2px; margin-inline: 8px; border-radius: var(--r-pill); background: var(--line); }
.quote-steps li > span {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border: 2px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    color: var(--faint);
}
.quote-steps li.is-done { color: var(--ink-2); }
.quote-steps li.is-done > span { border-color: var(--primary); background: var(--primary); color: #fff; }
.quote-steps li.is-done::after { background: var(--primary); }
.quote-steps li.is-current { color: var(--primary); }
.quote-steps li.is-current > span { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.quote-steps li.is-accepted { color: var(--t-emerald); }
.quote-steps li.is-accepted > span { border-color: var(--t-emerald); background: var(--t-emerald); color: #fff; box-shadow: 0 0 0 4px var(--t-emerald-soft); }
.quote-steps li.is-rejected { color: var(--danger); }
.quote-steps li.is-rejected > span { border-color: var(--danger); background: var(--danger); color: #fff; box-shadow: 0 0 0 4px var(--danger-soft); }
.quote-flow-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.quote-reject { display: flex; flex: 1 1 100%; gap: 6px; }
.quote-reject .form-control { max-width: 380px; }

.quote-lines-panel .panel-head { padding: var(--s-3) var(--s-4); }
.quote-lines { margin: 0; }
.quote-lines > thead > tr > th { white-space: nowrap; }
.quote-lines td { vertical-align: top; }
.quote-lines .ql-num { width: 36px; padding-top: 14px !important; color: var(--faint); text-align: center; }
.quote-lines .ql-desc { min-width: 220px; }
.quote-lines .ql-desc .ql-product { margin-bottom: 4px; color: var(--muted); }
.quote-lines .ql-unit { width: 92px; }
.quote-lines .ql-qty { width: 84px; }
.quote-lines .ql-price { width: 170px; }
.quote-lines .ql-price .money-input .form-control { padding-right: 46px; }
.quote-lines .ql-disc { width: 80px; }
.quote-lines .ql-total { width: 130px; padding-top: 12px !important; font-weight: 750; text-align: end; white-space: nowrap; }
.quote-lines .ql-del { width: 40px; }
/* ستون‌های عددی در صفحه‌های کم‌عرض فشرده می‌شدند و عدد داخل خانه دیده نمی‌شد */
.quote-lines .ql-unit { min-width: 80px; }
.quote-lines .ql-qty { min-width: 76px; }
.quote-lines .ql-disc { min-width: 72px; }
.quote-lines .ql-price { min-width: 150px; }
.quote-lines .ql-qty .form-control, .quote-lines .ql-disc .form-control { padding-inline: 8px; text-align: center; }
.quote-lines input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.quote-lines input[type="number"]::-webkit-inner-spin-button,
.quote-lines input[type="number"]::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
.quote-lines-empty { padding: var(--s-4); color: var(--muted); font-size: var(--text-sm); text-align: center; }
.quote-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: var(--s-3) var(--s-4); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--primary) 3%, var(--surface)); }
.quote-add .form-select { width: auto; min-width: 240px; max-width: 100%; }

.quote-summary { position: sticky; top: calc(var(--topbar-height) + 12px); }
.quote-sums { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; font-size: var(--text-sm); }
.quote-sums dt { color: var(--muted); font-weight: 500; }
.quote-sums dd { margin: 0; font-weight: 650; text-align: end; }
.quote-tax { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: var(--s-3) 0; }
.quote-tax-rate { display: flex; align-items: center; gap: 4px; }
.quote-tax-rate .form-control { width: 72px; }
.quote-grand {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    margin-top: var(--s-3);
    padding: 14px 16px;
    border-radius: var(--r-panel);
    background: var(--grad-brand);
    color: #fff;
    box-shadow: var(--glow-primary);
}
.quote-grand > span { flex: 1 1 100%; font-size: var(--text-xs); opacity: 0.85; }
.quote-grand strong { font-size: 1.6rem; font-weight: 850; line-height: 1.2; }
.quote-grand small { opacity: 0.85; }
.quote-words { margin: 8px 0 var(--s-3); color: var(--t-emerald); font-size: var(--text-sm); font-weight: 600; line-height: 1.8; }

/* ── پرونده‌ی لید: معاملات و پیش‌فاکتورها ── */
.lead-deals { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.lead-deal {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-inline-start: 4px solid var(--tone);
    border-radius: var(--r-control);
    background: var(--surface);
    color: var(--ink);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.lead-deal:hover { border-color: color-mix(in srgb, var(--tone) 40%, var(--line)); box-shadow: var(--shadow-card); color: var(--ink); }
.lead-deal > div { flex: 1; min-width: 0; }
.lead-deal strong { display: block; overflow: hidden; font-size: var(--text-sm); text-overflow: ellipsis; white-space: nowrap; }
.lead-deal small { color: var(--muted); font-size: var(--text-xs); }
.lead-deal .amount { font-size: var(--text-sm); font-weight: 750; white-space: nowrap; }
.card-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: var(--s-3); }
.card-panel-head h5 { margin: 0; }

@media (max-width: 1199px) {
    .quote-summary { position: static; }
}

/* ── ایمیل و اعلان‌ها (تنظیمات) و ارسال پیش‌فاکتور با ایمیل ── */
.email-panel h5 { margin-bottom: var(--s-3); }
.email-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: var(--s-3); }
.email-presets .chip i { margin-inline-end: 4px; }
.email-hint { display: flex; gap: 8px; align-items: flex-start; }
.email-toggles { display: grid; gap: 10px; }
.email-toggles .form-check-label i { margin-inline-end: 6px; }
.email-save { position: sticky; bottom: 0; display: flex; justify-content: flex-end; margin-top: var(--s-4); padding: var(--s-3) 0; background: linear-gradient(180deg, transparent, var(--canvas) 40%); }
.quote-mail-preview { display: flex; align-items: center; gap: 10px; margin-top: var(--s-3); padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: var(--r-control); background: var(--surface-sunken); font-size: var(--text-sm); }
.quote-mail-preview i { color: #d93a3a; font-size: 1.4rem; }
