/* =============================================
   TICKET POSTING — Integrated Header + Grid
   Pattern: Contract Notifications topbar
   ============================================= */

/* =============================================
   DIALOG SHELL (SfDialog wrapper)
   ============================================= */
.tp-dialog.e-dialog {
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35) !important;
    border: none !important;
    z-index: 1002 !important;
}

.tp-dialog.e-dialog.e-dlg-modal {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
    z-index: 1002 !important;
}

/* Ensure Post Tickets overlay sits above weighbridge ticket overlay */
.tp-dialog + .e-dlg-overlay,
.tp-dialog ~ .e-dlg-overlay,
#PostingDialog_overlay {
    z-index: 1001 !important;
}

.tp-dialog .e-dlg-header-content {
    background: #000 !important;
    padding: 0 !important;
    border-bottom: none !important;
    color: #fff !important;
}

.tp-dialog .e-dlg-header {
    width: 100% !important;
    color: #fff !important;
}

/* Force white on all header children — override Syncfusion inherited color */
.tp-dialog .e-dlg-header-content *,
.tp-dialog .e-dlg-header * {
    color: inherit;
}

.tp-header, .tp-header * {
    color: #fff;
}

/* Re-apply specific colors after the blanket white */
.tp-pill {
    color: rgba(255, 255, 255, 0.7) !important;
}

.tp-pill:hover {
    color: rgba(255, 255, 255, 0.9) !important;
}

.tp-pill-active {
    color: #000 !important;
}

.tp-pill-active.tp-pill-toll {
    color: #fff !important;
}

.tp-dialog .e-dlg-content {
    padding: 0 !important;
    background: var(--surface) !important;
}

/* =============================================
   HEADER BAR — single black bar, all controls
   ============================================= */
.tp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: #000;
    gap: 16px;
}

/* Left side — pills + hide pending */
.tp-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Right side — search + company + close */
.tp-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* =============================================
   FILTER PILLS — dark toolbar
   ============================================= */
.tp-pills {
    display: flex;
    gap: 4px;
}

.tp-pill {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    font-weight: 600;
    padding: 5px 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-sans);
}

.tp-pill:hover {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 255, 255, 0.18);
}

/* Active pill — amber default */
.tp-pill-active {
    background: #f59e0b !important;
    border-color: #f59e0b !important;
    color: #000 !important;
}

/* Type-specific active colors */
.tp-pill-active.tp-pill-sale {
    background: #22c55e !important;
    border-color: #22c55e !important;
}

.tp-pill-active.tp-pill-purchase {
    background: #f97316 !important;
    border-color: #f97316 !important;
}

.tp-pill-active.tp-pill-toll {
    background: #818cf8 !important;
    border-color: #818cf8 !important;
    color: #fff !important;
}

/* =============================================
   SEARCH BOX — dark toolbar
   ============================================= */
.tp-search {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 0 12px;
    height: 28px;
    min-width: 200px;
    transition: all 0.15s ease;
    gap: 8px;
}

.tp-search:focus-within {
    background: rgba(255, 255, 255, 0.12);
    border-color: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.18);
}

.tp-search i {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    flex-shrink: 0;
}

.tp-search-input {
    background: none;
    border: none;
    outline: none;
    color: #fff;
    font-size: 12px;
    width: 100%;
    height: 100%;
    padding: 0;
}

.tp-search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.tp-search-clear {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    font-size: 11px;
    flex-shrink: 0;
}

.tp-search-clear:hover {
    color: #f59e0b;
}

/* =============================================
   COMPANY DROPDOWN — dark toolbar, right side
   ============================================= */
.tp-company-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 0 8px;
    height: 28px;
    transition: all 0.15s ease;
    gap: 6px;
}

.tp-company-dropdown:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.18);
}

.tp-company-dropdown:focus-within {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.tp-company-dropdown i {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    flex-shrink: 0;
    pointer-events: none;
}

.tp-company-dropdown select {
    background: transparent;
    border: none;
    outline: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-sans);
    letter-spacing: 0.02em;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M1 1l3 3 3-3' stroke='rgba(255,255,255,0.4)' stroke-width='1.2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0 center;
}

.tp-company-dropdown select option {
    background: #1a1a1a;
    color: #fff;
    font-size: 12px;
}

/* =============================================
   CLOSE BUTTON — header
   ============================================= */
.tp-close-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: none;
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.15s;
    flex-shrink: 0;
}

.tp-close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* =============================================
   CONTENT AREA
   ============================================= */
.tp-posting-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--surface);
}

/* =============================================
   GRID CONTAINER
   ============================================= */
.tp-posting-grid-wrapper {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: var(--surface);
}

.tp-grid-scroll {
    overflow: auto;
    height: 100%;
    width: 100%;
    position: relative;
}

/* Custom scrollbar */
.tp-grid-scroll::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.tp-grid-scroll::-webkit-scrollbar-track {
    background: var(--bg-tertiary, #f1f5f9);
}

.tp-grid-scroll::-webkit-scrollbar-thumb {
    background: var(--border-primary, #cbd5e1);
    border-radius: 4px;
}

.tp-grid-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--text-disabled, #94a3b8);
}

/* =============================================
   TABLE — matches TicketsMain grid
   ============================================= */
.tp-grid {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

/* Sticky header */
.tp-grid thead {
    position: sticky;
    top: 0;
    z-index: 4;
}

.tp-grid thead tr {
    background: #000;
}

/* Header cells */
.tp-th {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 700;
    font-size: 11px;
    padding: 6px 10px;
    text-align: left;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: pointer;
    user-select: none;
    background: #000;
    position: relative;
    transition: background 0.1s;
}

.tp-th:hover {
    background: rgba(255, 255, 255, 0.06);
}

.tp-th:last-child {
    border-right: none;
}

/* Right-align numeric headers */
.tp-th-num {
    text-align: right;
}

/* Sort indicator */
.tp-th i.fa-sort-up,
.tp-th i.fa-sort-down {
    color: #f59e0b;
    font-size: 10px;
}

/* =============================================
   BODY ROWS
   ============================================= */
.tp-row {
    border-bottom: 1px solid var(--bg-tertiary, #f1f5f9);
    transition: background 0.08s;
    user-select: none;
    -webkit-user-select: none;
    cursor: pointer;
}

.tp-row td:first-child {
    border-left: 3px solid transparent;
}

.tp-row-sale td:first-child { border-left-color: #22c55e; }
.tp-row-purchase td:first-child { border-left-color: #f97316; }
.tp-row-toll td:first-child { border-left-color: #818cf8; }

.tp-row-inactive { opacity: 0.55; }

.tp-row:nth-child(even) {
    background: var(--surface-inset, rgba(0, 0, 0, 0.015));
}

.tp-row:hover td {
    background: rgba(245, 158, 11, 0.04);
}

.tp-row:hover td:first-child {
    background: rgba(245, 158, 11, 0.08);
}

.tp-row:active td {
    background: rgba(245, 158, 11, 0.08);
}

/* Body cells */
.tp-td {
    padding: 6px 10px;
    font-size: 12px;
    color: var(--text-primary);
    border-right: 1px solid var(--bg-tertiary, #f1f5f9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
    height: 36px;
    line-height: 24px;
    box-sizing: border-box;
    vertical-align: middle;
}

.tp-td:last-child {
    border-right: none;
}

/* Right-align numeric cells */
.tp-td-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Negative balance */
.tp-neg { color: #dc2626; font-weight: 600; }
[data-theme="dark"] .tp-neg { color: #f87171; }

/* =============================================
   TYPE PILLS (Sale / Purchase / Toll)
   ============================================= */
.tp-tp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.tp-tp-sale { background: #166534; color: #bbf7d0; }
.tp-tp-purchase { background: #78350f; color: #fed7aa; }
.tp-tp-toll { background: #312e81; color: #c7d2fe; }

/* =============================================
   CONTRACT CELL (number + badges)
   ============================================= */
.tp-cc {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tp-cn {
    font-weight: 600;
    font-family: var(--font-mono, 'Cascadia Code', monospace);
    font-size: 12.5px;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.tp-cn-pending {
    color: #92400e;
}

[data-theme="dark"] .tp-cn-pending {
    color: #fbbf24;
}

.tp-pkg {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    white-space: nowrap;
}

.tp-attach {
    color: var(--text-muted, #94a3b8);
    font-size: 12px;
}

/* =============================================
   PERIOD CELL
   ============================================= */
.tp-per {
    font-size: 12px;
    color: var(--text-secondary, #64748b);
    white-space: nowrap;
}

/* =============================================
   DUAL-LINE CELLS (Company / Product)
   ============================================= */
.tp-dl {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    line-height: 1.3;
}

.tp-dl-m {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}

.tp-dl-s {
    font-size: 10px;
    color: var(--text-muted, #94a3b8);
    font-family: var(--font-mono, monospace);
}

[data-theme="dark"] .tp-dl-m { color: #e5e5e5; }
[data-theme="dark"] .tp-dl-s { color: #666; }
[data-theme="dark"] .tp-per { color: #888; }

/* =============================================
   POST DETAIL MODAL (SfDialog wrapper)
   ============================================= */
.tp-detail-dialog.e-dialog {
    border-radius: 16px !important;
    overflow: hidden !important;
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.4) !important;
    border: none !important;
    z-index: 1004 !important;
}

.tp-detail-dialog.e-dialog.e-dlg-modal {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
    z-index: 1004 !important;
}

/* Detail dialog overlay above main dialog */
.tp-detail-dialog + .e-dlg-overlay,
.tp-detail-dialog ~ .e-dlg-overlay {
    z-index: 1003 !important;
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(2px);
}

.tp-detail-dialog .e-dlg-header-content {
    background: #000 !important;
    padding: 0 !important;
    border-bottom: none !important;
    color: #fff !important;
}

.tp-detail-dialog .e-dlg-header {
    width: 100% !important;
    color: #fff !important;
}

.tp-detail-dialog .e-dlg-header-content *,
.tp-detail-dialog .e-dlg-header * {
    color: inherit;
}

.tp-detail-dialog .e-dlg-content {
    padding: 0 !important;
    background: var(--surface, #fff) !important;
}

/* Modal Header — black bar */
.tp-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: #000;
}

.tp-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
}

.tp-modal-title i {
    font-size: 16px;
    color: #fff;
}

.tp-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: none;
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 14px;
}

.tp-modal-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Contract Info Strip */
.tp-modal-contract {
    background: var(--bg-secondary, #f1f5f9);
    padding: 14px 20px;
    border-bottom: 2px solid var(--border-secondary, #94a3b8);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tp-modal-contract-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tp-modal-contract-label {
    font-size: 10px;
    font-weight: 800;
    color: var(--text-secondary, #475569);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    min-width: 60px;
}

.tp-modal-contract-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}

.tp-modal-contract-detail {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #0f172a);
}

/* Modal Body — form fields */
.tp-modal-body {
    padding: 20px;
}

/* Modal Footer — dark bar like weighbridge */
.tp-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    background: #161616;
    position: relative;
}

.tp-modal-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
    opacity: 0.3;
}

/* Animations */

/* =============================================
   FORM ELEMENTS
   ============================================= */
.tp-form-group {
    margin-bottom: 16px;
}

.tp-form-group:last-child {
    margin-bottom: 0;
}

.tp-label {
    display: block;
    font-size: 11px;
    font-weight: 800;
    color: var(--text-secondary, #334155);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tp-select-wrapper {
    position: relative;
}

.tp-select {
    width: 100%;
    padding: 10px 40px 10px 14px;
    border: 2px solid var(--border-secondary, #94a3b8);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #0f172a);
    background: var(--surface);
    transition: all 0.15s;
    appearance: none;
    cursor: pointer;
    outline: none;
}

.tp-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--focus-ring, rgba(34, 197, 94, 0.15));
}

.tp-select-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary, #475569);
    pointer-events: none;
    font-size: 12px;
}

.tp-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border-secondary, #94a3b8);
    border-radius: 8px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    background: var(--surface);
    transition: all 0.15s;
    text-align: center;
    font-variant-numeric: tabular-nums;
    outline: none;
    box-sizing: border-box;
}

.tp-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--focus-ring, rgba(34, 197, 94, 0.15));
}

/* =============================================
   ACTION BUTTONS
   ============================================= */
.tp-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tp-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.tp-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
}

.tp-btn-primary {
    background: var(--accent-primary);
    color: var(--on-accent, #fff);
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tp-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
    filter: brightness(1.1);
}

.tp-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.tp-btn-primary i.fa-spinner {
    animation: tp-spin 1s linear infinite;
}

@keyframes tp-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* =============================================
   TICKET TYPE CARDS
   ============================================= */
.tp-type-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.tp-type-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    border: 2px solid var(--border-secondary, #94a3b8);
    border-radius: 10px;
    background: var(--surface, #fff);
    color: var(--text-primary, #1e293b);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-sans);
}

.tp-type-card i {
    font-size: 17px;
}

.tp-type-card:hover {
    border-color: var(--text-secondary, #475569);
    background: var(--bg-secondary, #f1f5f9);
}

.tp-type-active.tp-type-normal {
    border-color: var(--accent-primary, #22c55e);
    background: rgba(34, 197, 94, 0.06);
    color: var(--accent-primary, #22c55e);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.tp-type-active.tp-type-return {
    border-color: #f97316;
    background: rgba(249, 115, 22, 0.06);
    color: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

/* =============================================
   RETURN REASON CHIP (in detail modal)
   ============================================= */
.tp-return-reason-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(249, 115, 22, 0.1);
    border: 2px solid rgba(249, 115, 22, 0.4);
    border-radius: 8px;
    color: #c2410c;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 16px;
    cursor: pointer;
    transition: all 0.15s;
}

.tp-return-reason-chip:hover {
    background: rgba(249, 115, 22, 0.15);
    border-color: rgba(249, 115, 22, 0.6);
}

.tp-chip-edit {
    margin-left: auto;
    opacity: 0.5;
    font-size: 11px;
}

/* =============================================
   STEPPER (number of tickets)
   ============================================= */
.tp-stepper {
    display: flex;
    align-items: center;
    border: 2px solid var(--border-secondary, #94a3b8);
    border-radius: 10px;
    overflow: hidden;
}

.tp-stepper-btn {
    width: 50px;
    height: 50px;
    border: none;
    background: var(--bg-tertiary, #e2e8f0);
    color: var(--text-primary, #0f172a);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}

.tp-stepper-btn:hover:not(:disabled) {
    background: var(--accent-primary, #22c55e);
    color: #fff;
}

.tp-stepper-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.tp-stepper-input {
    flex: 1;
    border: none;
    border-left: 2px solid var(--border-secondary, #94a3b8);
    border-right: 2px solid var(--border-secondary, #94a3b8);
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    background: var(--surface, #fff);
    height: 50px;
    font-variant-numeric: tabular-nums;
    outline: none;
    -moz-appearance: textfield;
    box-sizing: border-box;
}

.tp-stepper-input::-webkit-outer-spin-button,
.tp-stepper-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.tp-stepper-input:focus {
    background: rgba(34, 197, 94, 0.03);
}

/* =============================================
   TEXTAREA
   ============================================= */
.tp-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border-secondary, #94a3b8);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary, #0f172a);
    background: var(--surface, #fff);
    resize: vertical;
    min-height: 70px;
    font-family: var(--font-sans);
    outline: none;
    transition: all 0.15s;
    box-sizing: border-box;
}

.tp-textarea:focus {
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}

/* =============================================
   RETURN REASON DIALOG (SfDialog)
   ============================================= */
.tp-reason-dialog.e-dialog {
    border-radius: 16px !important;
    overflow: hidden !important;
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.5) !important;
    border: none !important;
    z-index: 1006 !important;
}

.tp-reason-dialog.e-dialog.e-dlg-modal {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
    z-index: 1006 !important;
}

.tp-reason-dialog + .e-dlg-overlay,
.tp-reason-dialog ~ .e-dlg-overlay {
    z-index: 1005 !important;
    background: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(3px);
}

.tp-reason-dialog .e-dlg-header-content {
    padding: 0 !important;
    background: #161616 !important;
    border: none !important;
    position: relative;
}

.tp-reason-dialog .e-dlg-header-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #f97316, transparent);
    opacity: 0.4;
}

.tp-reason-dialog .e-dlg-header {
    width: 100% !important;
    color: #fff !important;
}

.tp-reason-dialog .e-dlg-header *,
.tp-reason-dialog .e-dlg-header-content * {
    color: inherit;
}

.tp-reason-dialog .e-dlg-content {
    padding: 0 !important;
    background: var(--surface, #fff) !important;
}

/* Reason dialog header */
.tp-reason-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
}

.tp-reason-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(249, 115, 22, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tp-reason-icon i {
    color: #f97316 !important;
    font-size: 16px;
}

.tp-reason-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff !important;
}

.tp-reason-sub {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5) !important;
    margin-top: 2px;
}

.tp-reason-body {
    padding: 20px;
}

/* Footer buttons in return reason dialog */
.tp-reason-dialog .e-footer-content,
.tp-reason-dialog .e-dlg-footerbar {
    background: #161616 !important;
    border-top: none !important;
    padding: 12px 20px !important;
    position: relative;
}

.tp-reason-dialog .e-footer-content::before,
.tp-reason-dialog .e-dlg-footerbar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #f97316, transparent);
    opacity: 0.3;
}

.tp-reason-dialog .e-footer-content .e-btn {
    background: rgba(255, 255, 255, 0.08) !important;
    color: rgba(255, 255, 255, 0.8) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.03em !important;
    font-size: 12px !important;
}

.tp-reason-dialog .e-footer-content .e-btn:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

.tp-reason-dialog .e-footer-content .e-btn.e-primary {
    background: #f97316 !important;
    color: #fff !important;
    border: none !important;
}

.tp-reason-dialog .e-footer-content .e-btn.e-primary:hover {
    filter: brightness(1.1) !important;
}

/* =============================================
   DARK THEME OVERRIDES
   ============================================= */
[data-theme="dark"] .tp-row:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .tp-row:hover td {
    background: rgba(245, 158, 11, 0.06);
}

[data-theme="dark"] .tp-row:hover td:first-child {
    background: rgba(245, 158, 11, 0.1);
}

[data-theme="dark"] .tp-cn { color: #e5e5e5; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1199px) {
    .tp-checkbox-label span {
        display: none;
    }
    .tp-dl-m { max-width: 130px; }
}

@media (max-width: 899px) {
    .tp-header {
        padding: 8px 14px;
        flex-wrap: wrap;
    }

    .tp-search {
        min-width: 160px;
    }
}

@media (max-width: 699px) {
    .tp-badge {
        display: none;
    }

    .tp-search {
        min-width: 120px;
    }

    .tp-detail-dialog.e-dialog {
        width: 95vw !important;
    }

    .tp-btn {
        width: 100%;
    }
}
