/* After-sales pages (js/aftersales.js): returns, serials & warranty, service contracts. Uses the tokens of style.css. */

/* ------------------------------------------------------------ new return: start, units, rules */

.as-start {
    align-items: start;
}

.as-field-label {
    font-weight: 600;
    font-size: .9rem;
}

.as-units {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin-bottom: 1rem;
}

.as-unit {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: .55rem .8rem;
}

.as-unit-chosen {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.as-unit-blocked {
    background: var(--surface-muted);
    color: var(--text-muted);
}

.as-unit-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem .6rem;
}

.as-unit-head input[type="checkbox"] {
    width: 1.05rem;
    height: 1.05rem;
    margin: 0;
}

.as-unit-name {
    font-weight: 600;
    cursor: pointer;
}

.as-unit-blocked .as-unit-name {
    cursor: default;
}

/* The kit a component line belongs to, after the product name */
.as-unit-name .kit-tag {
    margin-left: .45rem;
    font-weight: 500;
}

.as-serial {
    margin-left: .45rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 500;
    font-size: .88rem;
}

.as-unit-facts {
    font-size: .85rem;
}

.as-unit-body {
    margin-top: .7rem;
}

.as-unit-body[hidden] {
    display: none;
}

.as-rule {
    margin: .6rem 0 0;
    font-size: .88rem;
}

.as-rule-none {
    display: none;
}

.as-rule-ok {
    color: var(--success);
}

.as-rule-warn {
    color: var(--warning);
}

.as-rule-refused {
    color: var(--danger);
    font-weight: 600;
}

.as-submit {
    display: flex;
    flex-direction: column;
    gap: .8rem;
    max-width: 40rem;
}

/* ------------------------------------------------------------ return: status stepper */

.as-stepper {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
}

.as-step {
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: .2rem .6rem .2rem .25rem;
    border-radius: 999px;
    font-size: .82rem;
    color: var(--text-muted);
    background: var(--surface-muted);
    border: 1px solid var(--border);
}

.as-step-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.3rem;
    height: 1.3rem;
    border-radius: 50%;
    font-size: .72rem;
    font-weight: 700;
    background: var(--surface);
    border: 1px solid var(--border);
}

.as-step-done {
    color: var(--success);
    background: var(--success-soft);
    border-color: transparent;
}

.as-step-done .as-step-mark {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.as-step-current {
    color: var(--primary);
    background: var(--primary-soft);
    border-color: var(--primary);
    font-weight: 600;
}

.as-step-current .as-step-mark {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.as-step-rejected,
.as-step-rejected.as-step-current {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: var(--danger);
}

.as-step-rejected .as-step-mark {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

/* ------------------------------------------------------------ history timeline, documents, small tables */

.as-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
}

.as-timeline-item {
    display: grid;
    grid-template-columns: 11rem 1fr;
    gap: .2rem 1rem;
    padding: .5rem 0;
    border-bottom: 1px solid var(--border);
}

.as-timeline-item:last-child {
    border-bottom: 0;
}

.as-timeline-time {
    font-size: .85rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.as-timeline-detail,
.as-timeline-note {
    font-size: .85rem;
    color: var(--text-muted);
}

.as-timeline-note {
    white-space: pre-line;
}

.as-doc {
    white-space: nowrap;
}

.as-mini-table td,
.as-mini-table th {
    padding-top: .4rem;
    padding-bottom: .4rem;
}

.as-subsection {
    margin-top: 1.1rem;
}

.as-subsection h3 {
    font-size: .92rem;
    margin: 0 0 .5rem;
}

.as-chain {
    margin: 0 0 1rem;
    font-size: .88rem;
}

/* ------------------------------------------------------------ serials: scan box */

.as-scan {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .6rem 1rem;
}

.as-scan .form-field {
    flex: 1 1 18rem;
    max-width: 26rem;
}

.as-scan input {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.as-scan-result {
    flex-basis: 100%;
}

.as-scan-result:empty {
    display: none;
}

.as-scan-result p {
    margin: 0;
}

@media (max-width: 600px) {
    .as-timeline-item {
        grid-template-columns: 1fr;
    }
}
