.table-responsive-clean,
.table-container,
.table-responsive {
    width: 100%;
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.professional-table,
.data-table,
.driver-accounts-table,
.table,
.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
}

.professional-table th,
.professional-table td,
.data-table th,
.data-table td,
.table th,
.table td,
.modern-table th,
.modern-table td {
    padding: 10px 11px;
    border-bottom: 1px solid var(--border);
    text-align: right;
    vertical-align: middle;
}

.professional-table th,
.data-table th,
.table th,
.modern-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    color: #334155;
    background: #f1f5f9;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.professional-table tbody tr,
.data-table tbody tr,
.table tbody tr,
.modern-table tbody tr {
    transition: background 0.14s ease;
}

.professional-table tbody tr:hover,
.data-table tbody tr:hover,
.table tbody tr:hover,
.modern-table tbody tr:hover {
    background: #f0f6ff;
}

.professional-table tr:last-child td,
.data-table tr:last-child td,
.table tr:last-child td,
.modern-table tr:last-child td {
    border-bottom: 0;
}

.table-actions,
.table-actions-inline,
.inline-actions {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.order-external-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: #1d4ed8;
    direction: ltr;
    unicode-bidi: isolate;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    text-decoration: none;
}

.order-external-link:hover {
    color: #1e40af;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.order-external-link:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 3px;
    border-radius: 4px;
}

.order-external-link i {
    font-size: 10px;
}

[data-theme="dark"] .order-external-link {
    color: #93c5fd;
}

@media print {
    .order-external-link {
        color: inherit !important;
        text-decoration: none !important;
    }

    .order-external-link i {
        display: none !important;
    }
}

.table-actions--center,
.inline-actions-center {
    justify-content: center;
}

.status-pill,
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 4px 9px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.badge-success,
.status-success,
.status-completed {
    color: var(--success);
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.badge-warning,
.status-warning,
.status-pending {
    color: var(--warning);
    border-color: #fde68a;
    background: #fffbeb;
}

.badge-danger,
.status-danger,
.status-returned {
    color: var(--danger);
    border-color: #fecaca;
    background: #fef2f2;
}

.badge-info,
.status-info {
    color: var(--info);
    border-color: #bae6fd;
    background: #f0f9ff;
}

.rank-cell {
    width: 54px;
    color: var(--text-muted);
}

.driver-name-cell {
    font-weight: 800;
}

.actions-cell,
.action-buttons {
    display: inline-flex;
    justify-content: center;
    gap: 7px;
    flex-wrap: wrap;
}

.select-column,
.actions-col {
    width: 1%;
    white-space: nowrap;
}

.mini-profile,
.user-info-cell,
.delivery-profile,
.person-cell {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.avatar-circle-xs,
.user-avatar,
.person-avatar {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 34px;
    color: var(--primary);
    background: var(--primary-50);
    border: 1px solid rgba(15, 118, 110, 0.16);
    border-radius: var(--radius-sm);
    font-weight: 900;
}

.user-meta,
.person-details,
.profile-info {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.user-name,
.person-details strong,
.profile-info h4 {
    margin: 0;
    color: var(--text);
    font-weight: 800;
}

.user-id,
.person-details small,
.profile-info small {
    color: var(--text-muted);
    font-size: 12px;
}

.pagination-clean {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 14px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 34px;
    padding: 7px 10px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-weight: 800;
}

.page-link.active {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

@media (max-width: 760px) {
    .professional-table,
    .data-table {
        font-size: 12px;
    }

    .professional-table th,
    .professional-table td,
    .data-table th,
    .data-table td {
        padding: 8px;
    }
}

/* Premium Items list tooltip in table cells */
.items-tooltip-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.first-item-text {
    font-size: 12px;
    word-break: break-word;
    line-height: 1.4;
}

.items-count-badge {
    background: var(--primary-50);
    color: var(--primary);
    border: 1px solid var(--primary-200);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease-in-out;
    position: relative;
}

[data-theme="dark"] .items-count-badge {
    background: rgba(13, 110, 253, 0.15);
    color: #6ea8fe;
    border-color: rgba(13, 110, 253, 0.3);
}

.items-count-badge:hover {
    background: var(--primary);
    color: #fff !important;
    border-color: var(--primary);
}

.items-tooltip-content {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-lg);
    padding: 12px 14px;
    border-radius: var(--radius-md);
    z-index: 999;
    width: max-content;
    min-width: 260px;
    max-width: 320px;
    text-align: right;
    white-space: normal;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    cursor: default;
}

.items-tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: var(--border-strong) transparent transparent transparent;
}

.items-count-badge:hover .items-tooltip-content,
.items-count-badge:focus .items-tooltip-content,
.items-count-badge:focus-visible .items-tooltip-content {
    visibility: visible;
    opacity: 1;
    color: var(--text) !important;
}

.items-count-badge:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.warehouse-count-badge {
    color: #047857;
    background: #ecfdf5;
    border-color: #a7f3d0;
}

.warehouse-count-badge:hover,
.warehouse-count-badge:focus {
    color: #fff;
    background: #059669;
    border-color: #047857;
}

.tooltip-header {
    display: block;
    font-size: 12px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
    text-align: right;
}

.tooltip-item-row {
    display: flex;
    gap: 6px;
    font-size: 11px;
    color: var(--text);
    line-height: 1.5;
    padding-block: 4px;
    border-bottom: 1px dashed var(--border-soft);
    text-align: right;
}

.tooltip-item-row:last-child {
    border-bottom: none;
}

.item-index {
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
}

.item-text {
    font-weight: 500;
}
