/* Card aftersales chat Sonamart (public/js/aftersalesCards.js).
   Host mengatur warna lewat --as-* dan ukuran huruf dasar di pembungkusnya. */
:root {
    --as-primary: #2563EB;
    --as-primary-dark: #1D4ED8;
    --as-border: #E5E7EB;
    --as-soft: #F3F4F6;
    --as-muted: #6B7280;
    --as-text: #111827;
    --as-danger: #EF4444;
}

.as-item {
    color: var(--as-text);
    font-size: inherit;
}

.as-item + .as-item {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed var(--as-border);
}

.as-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--as-border);
}

.as-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-weight: 700;
    color: var(--as-primary);
    min-width: 0;
}

.as-title span {
    overflow-wrap: anywhere;
}

.as-status {
    flex-shrink: 0;
    background: var(--as-soft);
    color: #374151;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    white-space: nowrap;
}

.as-status.is-warn { background: #FEF3C7; color: #92400E; }
.as-status.is-ok { background: #DCFCE7; color: #166534; }
.as-status.is-danger { background: #FEE2E2; color: #B91C1C; }

/* Nama produk maksimal 2 baris */
.as-info strong {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.as-info div,
.as-meta,
.as-hint {
    color: var(--as-muted);
    font-size: 0.9em;
}

.as-step,
.as-missing {
    margin-top: 8px;
    line-height: 1.4;
}

.as-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--as-soft);
    color: var(--as-muted);
}

.as-total strong { color: var(--as-text); }

/* Invoice line items */
.as-line {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 4px;
    overflow-wrap: anywhere;
}

.as-line > span:last-child { flex-shrink: 0; }

.as-qty {
    display: block;
    color: var(--as-muted);
    font-size: 0.85em;
}

.as-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* Tombol selalu setengah lebar, ada atau tidak ada tombol Batalkan */
.as-actions > * {
    flex: 0 0 calc(50% - 4px);
}

.as-btn,
.as-btn-outline,
.as-btn-danger {
    display: inline-block;
    box-sizing: border-box;
    border-radius: 9px;
    padding: 7px 13px;
    font-size: 0.9em;
    font-weight: 700;
    font-family: inherit;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.as-btn {
    background: linear-gradient(135deg, var(--as-primary) 0%, var(--as-primary-dark) 100%);
    color: #FFFFFF;
    border: none;
}

.as-btn-outline {
    background: #FFFFFF;
    color: var(--as-primary);
    border: 1px dashed var(--as-primary);
}

.as-btn-danger {
    background: #FFFFFF;
    color: var(--as-danger);
    border: 1px solid #FCA5A5;
}

.as-btn-danger:hover:not(:disabled) { background: #FEE2E2; }

.as-btn:disabled,
.as-btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.as-block {
    display: block;
    width: 100%;
    margin-top: 12px;
}

.as-label {
    margin: 10px 0 6px;
    font-weight: 600;
}

.as-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.as-chip {
    background: #FFFFFF;
    color: var(--as-text);
    border: 1px solid var(--as-border);
    border-radius: 999px;
    padding: 5px 11px;
    font-size: 0.9em;
    font-family: inherit;
    cursor: pointer;
}

.as-chip[aria-pressed="true"] {
    background: var(--as-primary);
    border-color: var(--as-primary);
    color: #FFFFFF;
}

.as-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 8px;
    padding: 7px 10px;
    border: 1px solid var(--as-border);
    border-radius: 8px;
    font: inherit;
    resize: vertical;
}

.as-upload {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.as-upload .as-btn-outline { align-self: flex-start; }

.as-files {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.as-files:empty { display: none; }

.as-file {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--as-soft);
}

.as-file img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.as-file-video {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--as-muted);
    font-size: 1.3em;
}

.as-file-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(17, 24, 39, 0.7);
    color: #FFFFFF;
    font-size: 13px;
    line-height: 18px;
    cursor: pointer;
}

.as-note {
    margin-top: 8px;
    color: var(--as-muted);
    font-size: 0.9em;
}

.as-note.is-error { color: var(--as-danger); }

.as-link {
    display: inline-block;
    margin-top: 10px;
    color: var(--as-primary);
    font-size: 0.9em;
    font-weight: 600;
    text-decoration: none;
}
