/* Premium action bar + modal dialogs */
.premium-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
}

.premium-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    white-space: nowrap;
    background: #fff;
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.premium-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
    text-decoration: none;
}

.premium-btn-edit {
    border-color: #bfdbfe;
    color: #1d4ed8;
    background: #eff6ff;
}

.premium-btn-return {
    border-color: #fde68a;
    color: #b45309;
    background: #fffbeb;
}

.premium-btn-cancel {
    border-color: #fecaca;
    color: #b91c1c;
    background: #fef2f2;
}

.premium-btn-delete {
    border-color: #fecaca;
    color: #991b1b;
    background: #fff;
}

.premium-btn-import {
    border-color: #bbf7d0;
    color: #15803d;
    background: #f0fdf4;
}

.premium-modal {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.premium-modal.is-open {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.premium-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
}

.premium-modal-panel {
    position: relative;
    width: min(520px, 100%);
    max-height: min(90vh, calc(100dvh - 32px));
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: premiumModalIn 0.22s ease;
    margin: auto;
}

.premium-modal-panel > form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

@keyframes premiumModalIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.premium-modal-header {
    flex-shrink: 0;
    padding: 20px 22px 12px;
    border-bottom: 1px solid var(--border);
}

.premium-modal-header h3 {
    font-size: 1.125rem;
    margin-bottom: 4px;
}

.premium-modal-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.premium-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 18px 22px;
}

.premium-modal-footer {
    flex-shrink: 0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 14px 22px 20px;
    background: #f8fafc;
    border-top: 1px solid var(--border);
}

.qty-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
}

.qty-badge-warn {
    background: #fff7ed;
    color: #c2410c;
}

.qty-badge-ok {
    background: #ecfdf5;
    color: #047857;
}

.filter-card-premium {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.kpi-hero {
    border: 2px solid #bbf7d0;
    background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 100%);
}

.kpi-hero .kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #047857;
}

.kpi-subtle {
    opacity: 0.85;
}

.dash-kpi-highlight {
    border: 2px solid #86efac;
    background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 100%);
}

.dash-kpi-subtle {
    opacity: 0.88;
    background: #f8fafc;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.status-pill-sold { background: #dcfce7; color: #166534; }
.status-pill-draft { background: #e0e7ff; color: #3730a3; }
.status-pill-pending { background: #fef3c7; color: #92400e; }
.status-pill-partial { background: #ffedd5; color: #c2410c; }
.status-pill-returned { background: #fee2e2; color: #991b1b; }
.status-pill-cancelled { background: #f1f5f9; color: #64748b; }

.filter-grid-rc {
    align-items: end;
    gap: 12px 16px;
}

.filter-grid-rc .filter-actions {
    display: flex;
    align-items: flex-end;
}

.return-status-pill,
.cancellation-status-pill {
    display: inline-flex;
    align-items: center;
    margin-top: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
}

.return-status-requested { background: #e0e7ff; color: #3730a3; }
.return-status-approved { background: #dbeafe; color: #1d4ed8; }
.return-status-rejected { background: #fee2e2; color: #991b1b; }
.return-status-received { background: #dcfce7; color: #166534; }
.return-status-refunded { background: #fef3c7; color: #92400e; }
.return-status-closed { background: #f1f5f9; color: #475569; }

.cancellation-status-pending { background: #fef3c7; color: #92400e; }
.cancellation-status-approved { background: #dbeafe; color: #1d4ed8; }
.cancellation-status-cancelled { background: #f1f5f9; color: #64748b; }
.cancellation-status-rejected { background: #fee2e2; color: #991b1b; }

.qty-badge-good { background: #dcfce7; color: #166534; }

.text-sm { font-size: 0.8rem; }

.profit-breakdown-details { margin-top: 6px; }
.profit-breakdown-details summary {
    cursor: pointer;
    font-size: 12px;
    color: var(--info);
    font-weight: 600;
    list-style: none;
}
.profit-breakdown-details summary::-webkit-details-marker { display: none; }
.profit-breakdown-panel {
    margin-top: 8px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    min-width: 220px;
    text-align: left;
}
.profit-breakdown-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    padding: 4px 0;
    border-bottom: 1px dashed #e2e8f0;
}
.profit-breakdown-line:last-child { border-bottom: none; }
.profit-breakdown-subtotal { font-weight: 600; }
.profit-breakdown-total {
    font-weight: 700;
    border-top: 2px solid var(--border);
    margin-top: 4px;
    padding-top: 8px;
}
.profit-breakdown-deduct span { color: #64748b; }
.profit-breakdown-note {
    margin: 8px 0 0;
    font-size: 11px;
    color: #92400e;
    background: #fffbeb;
    padding: 6px 8px;
    border-radius: 6px;
}

.history-table-wrap {
    /* alias — styles in main.css .table-scroll */
}

@media (max-width: 768px) {
    .premium-toolbar {
        justify-content: flex-start;
    }
    .premium-btn {
        padding: 8px 12px;
    }
    .premium-modal {
        padding: 12px;
    }
    .premium-modal-panel {
        max-height: calc(100dvh - 24px);
        border-radius: 14px;
    }
    .premium-modal-header,
    .premium-modal-body,
    .premium-modal-footer {
        padding-left: 16px;
        padding-right: 16px;
    }
}

.radio-inline {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}
.radio-inline label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    cursor: pointer;
}

.order-timeline {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--border, #e2e8f0);
}
.order-timeline-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #64748b);
    margin-bottom: 8px;
}
.order-timeline-item {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) auto;
    gap: 4px 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border, #f1f5f9);
    font-size: 13px;
}
.order-timeline-item:last-child {
    border-bottom: none;
}
.order-timeline-current {
    background: #f8fafc;
    border-radius: 6px;
    padding: 8px;
    margin-top: 4px;
}
.order-timeline-label {
    font-weight: 600;
}
.order-timeline-date {
    font-size: 12px;
    color: var(--text-muted, #64748b);
    text-align: right;
}
.order-timeline-detail {
    grid-column: 1 / -1;
    font-size: 12px;
}
