.qs-modebar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 16px 0;
    padding: 8px;
    border: 1px solid #e6e8ee;
    border-radius: 12px;
    background: #fff;
}

.qs-modebar .qs-brand {
    font-weight: 700;
    letter-spacing: .04em;
    color: #1f4b99;
    margin-inline-end: auto;
}

.qs-modebar button {
    border: 1px solid #d5d9e2;
    background: #f7f8fb;
    border-radius: 999px;
    min-height: 40px;
    padding: 0 16px;
    font-weight: 600;
    white-space: nowrap;
}

.qs-modebar button.is-on {
    background: #1f4b99;
    color: #fff;
    border-color: #1f4b99;
}

.qs-root {
    direction: rtl;
    margin: 12px 16px 24px;
    color: #1c2430;
    font-family: "Varela Round", "Segoe UI", sans-serif;
    overflow-x: hidden;
}

.qs-root.qs-full {
    position: fixed;
    inset: 0;
    z-index: 2000;
    margin: 0;
    background: #f3f5f8;
    overflow: auto;
    padding: 12px;
}

.qs-body {
    display: block;
}

.qs-top, .qs-search, .qs-grid, .qs-lines, .qs-summary, .qs-actions, .qs-sale {
    background: #fff;
    border: 1px solid #e6e8ee;
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 12px;
}

.qs-who {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.qs-who strong { font-size: 1.15rem; }

.qs-paystate {
    margin-inline-start: auto;
    background: #eef3ff;
    border-radius: 999px;
    padding: 6px 12px;
    font-weight: 700;
}

.qs-top, .qs-head, .qs-tabs, .qs-actions, .qs-line, .qs-search-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.qs-tabs { flex: 1; }

.qs-tab, .qs-actions button, .qs-tile, .qs-recent, .qs-hit, .qs-icon {
    border: 1px solid #d5d9e2;
    background: #fff;
    border-radius: 12px;
    min-height: 48px;
}

.qs-tab {
    text-align: right;
    padding: 8px 12px;
    min-width: 140px;
}

.qs-tab.is-on { border-color: #1f4b99; box-shadow: inset 0 0 0 2px #1f4b99; }
.qs-tab small, .qs-muted { display: block; color: #667085; font-size: 12px; }
.qs-wait { background: #fff7e8; }
.qs-pay { background: #eef6ff; }
.qs-done { background: #eefaf1; color: #667085; }

.qs-search input, .qs-line input {
    min-height: 52px;
    border-radius: 12px;
    border: 1px solid #d5d9e2;
    padding: 0 12px;
    font-size: 1.05rem;
}

.qs-search input[dir="ltr"], .qs-ltr { direction: ltr; text-align: left; }

.qs-search-row input { flex: 1; }

.qs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 8px;
}

.qs-tile, .qs-recent {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
    gap: 4px;
    padding: 12px;
    text-align: right;
    min-height: 118px;
    cursor: pointer;
}

.qs-tile:hover, .qs-tile:focus-visible, .qs-recent:hover, .qs-recent:focus-visible { border-color: #1f4b99; outline: none; }
.qs-tile:active, .qs-recent:active { transform: translateY(1px); }
.qs-tile:disabled, .qs-recent:disabled { opacity: .45; cursor: not-allowed; }
.qs-tile b, .qs-recent b {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
}
.qs-price { font-size: 1.05rem; font-weight: 700; color: #1f4b99; }
.qs-tile.has-photo { color: #fff; background-size: cover; background-position: center; }
.qs-tile.has-photo .qs-price { color: #fff; }
.qs-tile.has-photo small, .qs-tile.has-photo b, .qs-tile.has-photo .qs-price { position: relative; text-shadow: 0 1px 2px rgba(0,0,0,.45); }

.qs-tile img { width: 100%; height: 64px; object-fit: contain; background: #f7f8fb; border-radius: 8px; }
.qs-tile-wrap { min-width: 0; }

.qs-lines {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: min(46vh, 520px);
    overflow: auto;
    padding-inline-end: 4px;
}
.qs-line { justify-content: space-between; }
.qs-line .qs-name { flex: 1; min-width: 140px; }
.qs-qty { display: flex; align-items: center; gap: 4px; }
.qs-qty input { width: 72px; text-align: center; }
.qs-icon { width: 44px; font-size: 20px; }
.qs-icon.qs-text { width: auto; min-width: 44px; padding: 0 14px; font-size: 15px; white-space: nowrap; }

.qs-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    position: sticky;
    bottom: 8px;
}

.qs-summary strong { font-size: 1.3rem; }
.qs-total { grid-column: 1 / -1; background: #1f4b99; color: #fff; border-radius: 12px; padding: 10px; }

.qs-actions button {
    flex: 1 1 9rem;
    font-weight: 700;
    font-size: 1.05rem;
    white-space: nowrap;
}

.qs-actions .qs-cash { background: #e9f8ef; }
.qs-actions .qs-card { background: #eef3ff; }
.qs-actions .qs-issue { background: #1f4b99; color: #fff; border-color: #1f4b99; }
.qs-payment {
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.qs-payment .card-body,
.qs-payment .tab-content,
.qs-payment .tab-space {
    padding: 8px 0 0;
    overflow: visible;
}

.qs-payment .nav-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
}

.qs-payment .nav-pills .nav-item {
    flex: 1 1 7.5rem;
    min-width: 0;
    margin: 0 !important;
}

.qs-payment .nav-pills .nav-item .nav-link {
    min-width: 0;
    width: 100%;
    min-height: 44px;
    padding: 8px 6px;
    font-size: 13px;
    line-height: 1.25;
    text-transform: none;
    white-space: normal;
    box-sizing: border-box;
}

.qs-payment .nav-pills .nav-item i {
    font-size: 16px;
    padding: 0 0 2px;
}

.qs-payment .row {
    margin-left: 0;
    margin-right: 0;
}

.qs-payment [class*="col-"] {
    flex: 1 1 100%;
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}

.qs-payment .bmd-label-floating,
.qs-payment label {
    position: static !important;
    transform: none !important;
    display: block;
    width: 100%;
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    color: #344054;
    text-align: right;
    white-space: normal;
}

.qs-payment .input-group {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
}

.qs-payment .form-control,
.qs-payment select,
.qs-payment input,
.qs-payment .input-group-text {
    min-height: 44px;
    max-width: 100%;
    box-sizing: border-box;
}

.qs-payment .input-group > .form-control,
.qs-payment .input-group > input {
    flex: 1 1 8rem;
    min-width: 0;
    width: auto;
}

.qs-payment .d-none.d-lg-block {
    display: none !important;
}

.qs-payment .d-lg-none {
    display: block !important;
}

.qs-payment .card {
    max-width: 100% !important;
    width: 100%;
    text-align: right;
}

.qs-payment .card label {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
}

.qs-payment .btn {
    min-height: 44px;
    white-space: nowrap;
}

.qs-sale .qs-detail,
.qs-stage-pay .qs-detail {
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.qs-sale .qs-detail label,
.qs-stage-pay .qs-detail label {
    display: block;
    margin: 0;
    font-weight: 600;
}

.qs-sale .qs-detail select,
.qs-sale .qs-detail input,
.qs-stage-pay .qs-detail select,
.qs-stage-pay .qs-detail input {
    width: 100%;
    min-height: 48px;
    border-radius: 12px;
    border: 1px solid #d5d9e2;
    padding: 0 12px;
    font-size: 1.05rem;
    background: #fff;
    box-sizing: border-box;
}

.qs-sale .qs-detail button,
.qs-stage-pay .qs-detail button {
    min-height: 48px;
    border: 1px solid #d5d9e2;
    border-radius: 12px;
    background: #fff;
    font-weight: 700;
}

.qs-hits, .qs-detail {
    border: 1px solid #e6e8ee;
    border-radius: 12px;
    margin-top: 8px;
    overflow: hidden;
}

.qs-hit-row { display: flex; gap: 8px; align-items: stretch; }
.qs-hit, .qs-detail { width: 100%; text-align: right; padding: 10px 12px; }
.qs-hit-row .qs-hit { flex: 1; }

.qs-note {
    background: #f7f8fb;
    border-radius: 12px;
    padding: 8px 12px;
    margin-bottom: 12px;
}

@media (max-width: 1100px) {
    .qs-work { grid-template-columns: 1fr; }
    .qs-lines { max-height: 42vh; }
}

@media (max-width: 720px) {
    .qs-summary { grid-template-columns: 1fr 1fr; bottom: 0; }
    .qs-modebar { margin: 8px; }
    .qs-root { margin: 8px; }
    .qs-actions button { flex: 1 1 100%; }
    .qs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .qs-line { align-items: stretch; }
    .qs-root, .qs-root * { max-width: 100%; }
}

@media (max-width: 390px) {
    .qs-grid { grid-template-columns: 1fr 1fr; }
    .qs-tab { min-width: 0; flex: 1 1 140px; }
    .qs-step b { display: none; }
    .qs-facts { grid-template-columns: 1fr; }
}

.qs-root {
    background: #f4f6f9;
    border-radius: 20px;
    padding: 14px;
}

.qs-top {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0 0 10px;
    margin-bottom: 0;
}

.qs-tabs {
    background: #fff;
    border: 1px solid #e7ebf2;
    border-radius: 14px;
    padding: 6px;
}

.qs-tab { min-height: 42px; min-width: 120px; }
.qs-who { margin-top: 8px; }
.qs-who strong { font-size: 1rem; }

.qs-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 14px;
}

.qs-step {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 52px;
    padding: 8px 12px;
    border: 1px solid #e4e7ee;
    border-radius: 14px;
    background: #fff;
    color: #667085;
    text-align: right;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.qs-step span {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #f2f4f7;
    color: #475467;
    font-weight: 700;
    flex: 0 0 auto;
}

.qs-step b { font-size: 14px; font-weight: 700; }
.qs-step.is-on { border-color: #1f4b99; color: #1f4b99; box-shadow: 0 8px 20px rgba(31, 75, 153, .12); }
.qs-step.is-on span { background: #1f4b99; color: #fff; }
.qs-step.is-done { color: #175cd3; border-color: #d6e4ff; background: #f8fbff; }
.qs-step.is-done span { background: #e8f0fe; color: #175cd3; }
.qs-step:disabled { opacity: .55; }

.qs-stage { margin-bottom: 12px; }
.qs-sheet, .qs-pick, .qs-sale {
    background: #fff;
    border: 1px solid #e6e8ee;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(16, 24, 40, .04);
}

.qs-sheet { padding: 18px; }
.qs-stage-head h2 { margin: 0 0 4px; font-size: 1.25rem; font-weight: 700; color: #101828; }
.qs-stage-head p { margin: 0 0 16px; color: #667085; font-size: 14px; }

.qs-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
}

.qs-facts div {
    background: #f8fafc;
    border-radius: 12px;
    padding: 10px 12px;
}

.qs-facts small { display: block; color: #667085; font-size: 12px; }
.qs-facts strong { display: block; margin-top: 2px; font-size: 15px; }

.qs-work {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr);
    gap: 12px;
    align-items: start;
}

.qs-pick, .qs-sale { padding: 14px; min-width: 0; }
.qs-stage .qs-search,
.qs-stage .qs-grid,
.qs-stage .qs-lines,
.qs-stage .qs-summary,
.qs-stage .qs-actions {
    border: 0;
    box-shadow: none;
    background: transparent;
    margin-bottom: 0;
    padding: 0;
}

.qs-stage .qs-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.qs-sum-band {
    display: grid;
    grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr);
    gap: 8px;
}

.qs-sum-group {
    display: grid;
    gap: 2px 12px;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid #eef1f6;
    border-radius: 12px;
    background: #f8fafc;
}

.qs-sum-group > span {
    color: #667085;
    font-size: 11px;
    font-weight: 700;
}

.qs-sum-group p {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin: 0;
}

.qs-sum-group small { color: #667085; font-size: 12px; }
.qs-sum-group strong {
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.qs-sum-due {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 12px;
    background: #1f4b99;
    color: #fff;
}

.qs-sum-due small { font-size: 12px; opacity: .85; }
.qs-sum-due strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.qs-summary-pay .qs-sum-due strong { font-size: 1.6rem; }
.qs-summary-pay .qs-sum-group { background: #fff; }

.qs-pay-flag.is-paid strong:last-child { color: #067647; }
.qs-pay-flag.is-partial strong:last-child { color: #b54708; }
.qs-pay-flag.is-unpaid strong:last-child { color: #b42318; }
.qs-pay-flag.is-pending strong:last-child { color: #175cd3; }

.qs-stage .qs-line {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(6.5rem, .7fr) 8.2rem 5.2rem 6.2rem auto;
    align-items: center;
    border: 0;
    border-bottom: 1px solid #eef1f6;
    border-radius: 0;
    padding: 8px 2px;
    background: transparent;
    gap: 8px;
}

.qs-line-head {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #fff;
    color: #667085;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
    padding-top: 0;
}

.qs-line-head span:empty { display: block; }

.qs-name small { display: block; color: #667085; font-size: 11px; }
.qs-name b {
    display: block;
    font-size: 14px;
    line-height: 1.35;
    font-weight: 700;
}

.qs-unit label,
.qs-unit .small,
.qs-discount small {
    display: block;
    margin: 0;
    color: #667085;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
}

.qs-unit .form-control,
.qs-unit input,
.qs-discount input,
.qs-qty input {
    width: 100%;
    min-height: 36px;
    height: 36px;
    margin: 0;
    padding: 0 8px;
    border: 1px solid #e4e7ee;
    border-radius: 8px;
    background: #fff;
    box-shadow: none;
    font-size: 14px;
}

.qs-qty { justify-content: center; }
.qs-qty .qs-icon,
.qs-line-tools .qs-icon {
    width: 32px;
    min-height: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 16px;
}

.qs-line-tools { display: flex; gap: 4px; }
.qs-linetotal {
    min-height: 36px;
    border: 0;
    background: transparent;
    color: #101828;
    font-weight: 700;
    text-align: left;
    padding: 0;
}

.qs-stage-details .qs-search-row {
    display: grid;
    grid-template-columns: 5.5rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
}

.qs-stage-details .qs-search-row label {
    margin: 0;
    color: #344054;
    font-size: 13px;
    font-weight: 700;
}

.qs-stage-products .qs-pick > .qs-search-row input {
    min-height: 48px;
    background: #f8fafc;
    border-color: #e4e7ee;
    font-size: 1.02rem;
}

.qs-stage-pay .qs-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 16px;
}

.qs-stage-pay .qs-issue {
    grid-column: 1 / -1;
    min-height: 52px;
}

.qs-stage-pay .qs-summary { margin-bottom: 16px; }

.qs-stage:not([hidden]) .qs-sheet,
.qs-stage:not([hidden]) .qs-work {
    animation: qs-in .18s ease;
}

@keyframes qs-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .qs-stage:not([hidden]) .qs-sheet,
    .qs-stage:not([hidden]) .qs-work { animation: none; }
}

.qs-stage .qs-grid { align-items: start; }
.qs-stage .qs-tile-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
}
.qs-stage .qs-tile,
.qs-stage .qs-recent {
    width: 100%;
    height: 112px;
    min-height: 112px;
    max-height: 112px;
    box-sizing: border-box;
    overflow: hidden;
}
.qs-stage .qs-tile b,
.qs-stage .qs-recent b {
    min-height: 0;
    max-height: 2.6em;
    overflow: hidden;
    overflow-wrap: anywhere;
}
.qs-stage .qs-tile small,
.qs-stage .qs-recent small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.qs-stage .qs-price { margin-top: auto; }

.qs-desc {
    width: 100%;
    min-height: 48px;
    max-height: 84px;
    margin: 0;
    padding: 6px 8px;
    border: 1px solid #d5d9e2;
    border-radius: 8px;
    resize: vertical;
    font: inherit;
    line-height: 1.35;
    box-sizing: border-box;
}
.qs-desc-actions { display: flex; gap: 6px; }
.qs-desc-actions button {
    min-height: 32px;
    border: 1px solid #d5d9e2;
    border-radius: 8px;
    background: #fff;
    padding: 0 10px;
    font-weight: 700;
}
.qs-name b {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}
.qs-empty {
    border: 1px dashed #d5d9e2;
    border-radius: 12px;
    color: #667085;
    padding: 18px;
    text-align: center;
}

.qs-stage-nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; }
.qs-stage-nav button, .qs-next {
    min-height: 44px;
    border-radius: 12px;
    border: 1px solid #d5d9e2;
    background: #fff;
    padding: 0 16px;
    font-weight: 700;
}
.qs-next, .qs-stage-nav .qs-next { background: #1f4b99; color: #fff; border-color: #1f4b99; }

.qs-pay-sheet .qs-total { grid-column: 1 / -1; }

@media (max-width: 1024px) {
    .qs-sum-band { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .qs-work, .qs-facts { grid-template-columns: 1fr; }
    .qs-step { min-height: 44px; }
    .qs-sheet, .qs-pick, .qs-sale { padding: 12px; }
    .qs-lines { max-height: 38vh; }
    .qs-line-head { display: none; }
    .qs-stage .qs-line {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "name tools"
            "unit qty"
            "discount total";
    }
    .qs-name { grid-area: name; }
    .qs-line-tools { grid-area: tools; }
    .qs-unit { grid-area: unit; }
    .qs-qty { grid-area: qty; justify-content: flex-end; }
    .qs-discount { grid-area: discount; }
    .qs-linetotal { grid-area: total; }
    .qs-stage-details .qs-search-row,
    .qs-stage-pay .qs-actions { grid-template-columns: 1fr; }
    .qs-stage-pay .qs-issue { grid-column: auto; }
}

@media (max-width: 390px) {
    .qs-stage .qs-line { grid-template-columns: 1fr; grid-template-areas: "name" "unit" "qty" "discount" "total" "tools"; }
    .qs-qty, .qs-line-tools { justify-content: flex-start; }
    .qs-stage .qs-tile,
    .qs-stage .qs-recent { height: 104px; min-height: 104px; max-height: 104px; }
}
