/* ===================================================
   TopSystem - Base Theme CSS
   =================================================== */

:root {
    --ts-primary: #2563eb;
    --ts-primary-hover: #1d4ed8;
    --ts-secondary: #64748b;
    --ts-success: #16a34a;
    --ts-danger: #dc2626;
    --ts-warning: #f59e0b;
    --ts-info: #0891b2;
    --ts-dark: #1e293b;
    --ts-light: #f8fafc;
    --ts-border: #e2e8f0;
    --ts-text: #334155;
    --ts-text-muted: #94a3b8;
    --ts-font: 'Vazirmatn', Tahoma, Arial, sans-serif;
    --ts-sidebar-width: 260px;
    --ts-navbar-height: 60px;
    --ts-mobile-bottom-height: 64px;
    --ts-radius: 0.5rem;
    --ts-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --ts-shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 14px;
}

body {
    font-family: var(--ts-font);
    background: #f1f5f9;
    color: var(--ts-text);
    direction: rtl;
    line-height: 1.7;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: var(--ts-primary);
}
a:hover {
    color: var(--ts-primary-hover);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ===================================================
   LAYOUT
   =================================================== */

/* -- Sidebar (Desktop) -- */
.ts-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--ts-sidebar-width);
    height: 100vh;
    background: var(--ts-dark);
    color: #e2e8f0;
    z-index: 1040;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.ts-sidebar-brand {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.ts-sidebar-brand img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
}

.ts-sidebar-brand h1 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: #fff;
}

.ts-sidebar-brand small {
    font-size: 0.7rem;
    color: var(--ts-text-muted);
}

.ts-sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.ts-sidebar-nav .nav-section {
    padding: 8px 20px 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ts-sidebar-nav .nav-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: #cbd5e1;
    font-size: 0.9rem;
    border-radius: 0;
    transition: all 0.15s;
}

.ts-sidebar-nav .nav-item a:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.ts-sidebar-nav .nav-item a.active {
    background: var(--ts-primary);
    color: #fff;
}

.ts-sidebar-nav .nav-item a i {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
}

.ts-sidebar-nav .nav-item .badge {
    margin-right: auto;
    font-size: 0.65rem;
}

.ts-sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

/* -- Navbar (Top) -- */
.ts-navbar {
    position: fixed;
    top: 0;
    right: var(--ts-sidebar-width);
    left: 0;
    height: var(--ts-navbar-height);
    background: #fff;
    border-bottom: 1px solid var(--ts-border);
    z-index: 1030;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    box-shadow: var(--ts-shadow);
}

.ts-navbar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--ts-text);
    cursor: pointer;
    padding: 4px;
}

.ts-navbar .ts-branch-badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
}

.ts-navbar-spacer {
    flex: 1;
}

.ts-navbar .ts-nav-icon {
    position: relative;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--ts-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: background 0.15s;
}
.ts-navbar .ts-nav-icon:hover {
    background: #f1f5f9;
    color: var(--ts-text);
}
.ts-navbar .ts-nav-icon .ts-badge-dot {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 8px;
    height: 8px;
    background: var(--ts-danger);
    border-radius: 50%;
    border: 2px solid #fff;
}

.ts-user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.15s;
}
.ts-user-menu:hover {
    background: #f1f5f9;
}
.ts-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--ts-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}
.ts-user-info {
    line-height: 1.3;
}
.ts-user-info .name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ts-text);
}
.ts-user-info .role {
    font-size: 0.7rem;
    color: var(--ts-text-muted);
}

/* -- Main Content -- */
.ts-main {
    margin-right: var(--ts-sidebar-width);
    padding-top: var(--ts-navbar-height);
    min-height: 100vh;
}

.ts-content {
    padding: 24px;
}

/* -- Page Header -- */
.ts-page-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.ts-page-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
    color: var(--ts-dark);
}

.ts-page-header .ts-breadcrumb {
    font-size: 0.8rem;
    color: var(--ts-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.ts-page-header .ts-breadcrumb a {
    color: var(--ts-text-muted);
}
.ts-page-header .ts-breadcrumb a:hover {
    color: var(--ts-primary);
}

.ts-page-actions {
    margin-right: auto;
    display: flex;
    gap: 8px;
}

/* -- Overlay (mobile sidebar) -- */
.ts-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1035;
}
.ts-overlay.show {
    display: block;
}

/* -- Mobile Bottom Nav -- */
.ts-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    height: var(--ts-mobile-bottom-height);
    background: #fff;
    border-top: 1px solid var(--ts-border);
    z-index: 1030;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}

.ts-bottom-nav-items {
    display: flex;
    height: 100%;
}

.ts-bottom-nav-items a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--ts-secondary);
    font-size: 0.65rem;
    font-weight: 500;
    text-decoration: none;
    position: relative;
    transition: color 0.15s;
    min-width: 0;
    padding: 4px 2px;
}
.ts-bottom-nav-items a i {
    font-size: 1.3rem;
}
.ts-bottom-nav-items a.active {
    color: var(--ts-primary);
}
.ts-bottom-nav-items a .ts-badge-dot {
    position: absolute;
    top: 6px;
    left: calc(50% - 16px);
    width: 7px;
    height: 7px;
    background: var(--ts-danger);
    border-radius: 50%;
    border: 2px solid #fff;
}

/* ===================================================
   CARDS
   =================================================== */
.ts-card {
    background: #fff;
    border-radius: var(--ts-radius);
    border: 1px solid var(--ts-border);
    box-shadow: var(--ts-shadow);
    margin-bottom: 24px;
}

.ts-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--ts-border);
}

.ts-card-header h5 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: var(--ts-dark);
}

.ts-card-header .ts-card-actions {
    margin-right: auto;
    display: flex;
    gap: 6px;
}

.ts-card-body {
    padding: 20px;
}

.ts-card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--ts-border);
    background: #fafbfc;
    border-radius: 0 0 var(--ts-radius) var(--ts-radius);
}

/* -- Stat Card -- */
.ts-stat-card {
    background: #fff;
    border-radius: var(--ts-radius);
    border: 1px solid var(--ts-border);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--ts-shadow);
    transition: box-shadow 0.2s;
}
.ts-stat-card:hover {
    box-shadow: var(--ts-shadow-lg);
}

.ts-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.ts-stat-content .ts-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--ts-dark);
    line-height: 1.2;
}

.ts-stat-content .ts-stat-label {
    font-size: 0.8rem;
    color: var(--ts-text-muted);
}

/* ===================================================
   TABLE
   =================================================== */
.ts-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ts-table {
    width: 100%;
    white-space: nowrap;
    margin: 0;
}

.ts-table thead th {
    background: #f8fafc;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ts-secondary);
    border-bottom: 2px solid var(--ts-border);
    padding: 12px 16px;
    white-space: nowrap;
}

.ts-table tbody td {
    padding: 12px 16px;
    font-size: 0.85rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.ts-table tbody tr:hover {
    background: #f8fafc;
}

.ts-table .ts-actions-cell {
    text-align: center;
    white-space: nowrap;
}

.ts-table .ts-actions-cell .btn {
    padding: 4px 8px;
    font-size: 0.8rem;
}

/* -- Mobile Card List (replaces table on mobile) -- */
.ts-card-list {
    display: none;
}

.ts-card-list-item {
    background: #fff;
    border: 1px solid var(--ts-border);
    border-radius: var(--ts-radius);
    padding: 14px 16px;
    margin-bottom: 10px;
}

.ts-card-list-item .ts-card-list-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    font-size: 0.85rem;
}

.ts-card-list-item .ts-card-list-label {
    color: var(--ts-text-muted);
    font-size: 0.75rem;
}

.ts-card-list-item .ts-card-list-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
}

/* ===================================================
   STATUS BADGE
   =================================================== */
.ts-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.ts-status-received      { background: #dbeafe; color: #1e40af; }
.ts-status-diagnosing    { background: #fef3c7; color: #92400e; }
.ts-status-waiting       { background: #fce7f3; color: #9d174d; }
.ts-status-waiting-part  { background: #ede9fe; color: #5b21b6; }
.ts-status-repairing     { background: #ffedd5; color: #c2410c; }
.ts-status-ready         { background: #d1fae5; color: #065f46; }
.ts-status-delivered     { background: #f1f5f9; color: #475569; }
.ts-status-cancelled     { background: #fee2e2; color: #991b1b; }

.ts-status::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.6;
}

/* ===================================================
   FORMS
   =================================================== */
.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ts-text);
    margin-bottom: 4px;
}

.form-control, .form-select {
    font-family: var(--ts-font);
    font-size: 0.88rem;
    border-radius: var(--ts-radius);
    border: 1px solid var(--ts-border);
    padding: 10px 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
    min-height: 44px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--ts-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-control::placeholder {
    color: #b0bec5;
    font-size: 0.82rem;
}

.ts-form-hint {
    font-size: 0.72rem;
    color: var(--ts-text-muted);
    margin-top: 4px;
}

.ts-required::after {
    content: ' *';
    color: var(--ts-danger);
}

/* -- Search Box -- */
.ts-search-box {
    position: relative;
}

.ts-search-box input {
    padding-right: 40px;
}

.ts-search-box i {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ts-text-muted);
    pointer-events: none;
}

/* -- File Upload -- */
.ts-file-upload {
    border: 2px dashed var(--ts-border);
    border-radius: var(--ts-radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.ts-file-upload:hover,
.ts-file-upload.dragover {
    border-color: var(--ts-primary);
    background: #eff6ff;
}

.ts-file-upload i {
    font-size: 2rem;
    color: var(--ts-text-muted);
    margin-bottom: 8px;
}

.ts-file-upload p {
    margin: 0;
    font-size: 0.82rem;
    color: var(--ts-text-muted);
}

.ts-file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.ts-file-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--ts-border);
}

.ts-file-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ts-file-preview-item .ts-file-remove {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--ts-danger);
    color: #fff;
    border: none;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* ===================================================
   BUTTONS
   =================================================== */
.btn {
    font-family: var(--ts-font);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 8px 18px;
    border-radius: var(--ts-radius);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    transition: all 0.15s;
}

.btn-sm {
    font-size: 0.78rem;
    padding: 5px 12px;
    min-height: 32px;
}

.btn-lg {
    font-size: 0.95rem;
    padding: 12px 28px;
    min-height: 48px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
}

.btn-icon.btn-sm {
    width: 32px;
    height: 32px;
}

/* Loading state */
.btn.ts-loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn.ts-loading .spinner-border {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

/* ===================================================
   MODAL
   =================================================== */
.modal-content {
    font-family: var(--ts-font);
    border: none;
    border-radius: var(--ts-radius);
    box-shadow: var(--ts-shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--ts-border);
    padding: 16px 20px;
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    border-top: 1px solid var(--ts-border);
    padding: 12px 20px;
    gap: 8px;
}

/* Confirm Modal */
.ts-confirm-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 16px;
}

.ts-confirm-icon.danger {
    background: #fee2e2;
    color: var(--ts-danger);
}

.ts-confirm-icon.warning {
    background: #fef3c7;
    color: var(--ts-warning);
}

.ts-confirm-icon.success {
    background: #d1fae5;
    color: var(--ts-success);
}

/* ===================================================
   ALERTS & TOAST
   =================================================== */
.ts-toast-container {
    position: fixed;
    top: 80px;
    left: 24px;
    z-index: 1090;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
    width: calc(100% - 48px);
}

.ts-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--ts-radius);
    background: #fff;
    border: 1px solid var(--ts-border);
    box-shadow: var(--ts-shadow-lg);
    animation: tsToastIn 0.3s ease;
    font-size: 0.85rem;
}

.ts-toast.hide {
    animation: tsToastOut 0.3s ease forwards;
}

.ts-toast-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.ts-toast-body {
    flex: 1;
}

.ts-toast-title {
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 2px;
}

.ts-toast-message {
    font-size: 0.8rem;
    color: var(--ts-text-muted);
}

.ts-toast-close {
    background: none;
    border: none;
    color: var(--ts-text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    margin-right: -4px;
}

.ts-toast.ts-toast-success { border-right: 4px solid var(--ts-success); }
.ts-toast.ts-toast-danger  { border-right: 4px solid var(--ts-danger); }
.ts-toast.ts-toast-warning { border-right: 4px solid var(--ts-warning); }
.ts-toast.ts-toast-info    { border-right: 4px solid var(--ts-info); }

.ts-toast.ts-toast-success .ts-toast-icon { color: var(--ts-success); }
.ts-toast.ts-toast-danger .ts-toast-icon  { color: var(--ts-danger); }
.ts-toast.ts-toast-warning .ts-toast-icon { color: var(--ts-warning); }
.ts-toast.ts-toast-info .ts-toast-icon    { color: var(--ts-info); }

@keyframes tsToastIn {
    from { opacity: 0; transform: translateX(-30px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes tsToastOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(-30px); }
}

/* ===================================================
   PAGINATION
   =================================================== */
.ts-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 0;
    font-size: 0.82rem;
}

.ts-pagination-info {
    color: var(--ts-text-muted);
}

.ts-pagination .page-link {
    font-family: var(--ts-font);
    color: var(--ts-text);
    border-color: var(--ts-border);
    font-size: 0.82rem;
    min-width: 36px;
    text-align: center;
    padding: 6px 12px;
}

.ts-pagination .page-item.active .page-link {
    background: var(--ts-primary);
    border-color: var(--ts-primary);
}

/* ===================================================
   EMPTY STATE
   =================================================== */
.ts-empty {
    text-align: center;
    padding: 48px 20px;
}

.ts-empty i {
    font-size: 3rem;
    color: #cbd5e1;
    margin-bottom: 12px;
}

.ts-empty h5 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ts-text);
    margin-bottom: 4px;
}

.ts-empty p {
    font-size: 0.82rem;
    color: var(--ts-text-muted);
    margin-bottom: 16px;
}

/* ===================================================
   LOADING / SKELETON
   =================================================== */
.ts-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: inherit;
}

.ts-skeleton {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: tsShimmer 1.5s infinite;
    border-radius: 4px;
    height: 16px;
    margin-bottom: 8px;
}

@keyframes tsShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===================================================
   TIMELINE (Repair Notes)
   =================================================== */
.ts-timeline {
    position: relative;
    padding-right: 28px;
}

.ts-timeline::before {
    content: '';
    position: absolute;
    right: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--ts-border);
}

.ts-timeline-item {
    position: relative;
    padding-bottom: 24px;
}

.ts-timeline-item::before {
    content: '';
    position: absolute;
    right: -24px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--ts-primary);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--ts-border);
}

.ts-timeline-item .ts-timeline-date {
    font-size: 0.72rem;
    color: var(--ts-text-muted);
    margin-bottom: 4px;
}

.ts-timeline-item .ts-timeline-body {
    background: #f8fafc;
    border: 1px solid var(--ts-border);
    border-radius: var(--ts-radius);
    padding: 12px 16px;
    font-size: 0.85rem;
}

.ts-timeline-item .ts-timeline-author {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--ts-dark);
}

/* ===================================================
   RESPONSIVE
   =================================================== */

/* Tablet and below */
@media (max-width: 991.98px) {
    .ts-sidebar {
        transform: translateX(100%);
    }
    .ts-sidebar.show {
        transform: translateX(0);
    }

    .ts-navbar {
        right: 0;
    }

    .ts-navbar-toggle {
        display: block;
    }

    .ts-main {
        margin-right: 0;
    }

    .ts-bottom-nav {
        display: block;
    }

    .ts-content {
        padding-bottom: calc(var(--ts-mobile-bottom-height) + 24px);
    }

    .ts-page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .ts-page-actions {
        margin-right: 0;
        width: 100%;
    }

    .ts-page-actions .btn {
        flex: 1;
        justify-content: center;
    }
}

/* Mobile */
@media (max-width: 575.98px) {
    html {
        font-size: 13px;
    }

    .ts-content {
        padding: 16px 12px;
        padding-bottom: calc(var(--ts-mobile-bottom-height) + 16px);
    }

    .ts-card-body {
        padding: 14px;
    }

    .ts-stat-card {
        padding: 14px;
    }

    /* Show card list, hide table on mobile */
    .ts-table-wrapper {
        display: none;
    }
    .ts-card-list {
        display: block;
    }

    .ts-toast-container {
        left: 12px;
        right: 12px;
        top: 70px;
        max-width: 100%;
    }

    .ts-navbar {
        padding: 0 12px;
    }

    .ts-user-info {
        display: none;
    }

    .modal-dialog {
        margin: 8px;
    }
}

/* Desktop large */
@media (min-width: 1400px) {
    html {
        font-size: 15px;
    }
}

/* ===================================================
   SIDEBAR SUB-MENU
   =================================================== */
.ts-sidebar-nav .nav-item .ts-submenu-toggle {
    position: relative;
    cursor: pointer;
}

.ts-sidebar-nav .nav-item .ts-submenu-toggle::after {
    content: '\F282';
    font-family: 'bootstrap-icons';
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.65rem;
    transition: transform 0.2s;
    color: #64748b;
}

.ts-sidebar-nav .nav-item .ts-submenu-toggle[aria-expanded="true"]::after {
    transform: translateY(-50%) rotate(-90deg);
}

.ts-sidebar-nav .ts-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    background: rgba(0,0,0,0.15);
}

.ts-sidebar-nav .ts-submenu li a {
    padding: 8px 20px 8px 20px;
    padding-right: 52px;
    font-size: 0.82rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s;
}

.ts-sidebar-nav .ts-submenu li a::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #64748b;
    flex-shrink: 0;
}

.ts-sidebar-nav .ts-submenu li a:hover {
    color: #fff;
    background: rgba(255,255,255,0.04);
}

.ts-sidebar-nav .ts-submenu li a.active {
    color: #fff;
    background: rgba(37, 99, 235, 0.3);
}

.ts-sidebar-nav .ts-submenu li a.active::before {
    background: var(--ts-primary);
}

/* ===================================================
   TABS
   =================================================== */
.ts-tabs {
    border-bottom: 2px solid var(--ts-border);
    gap: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ts-tabs .nav-link {
    font-family: var(--ts-font);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ts-secondary);
    padding: 12px 20px;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    border-radius: 0;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}

.ts-tabs .nav-link:hover {
    color: var(--ts-text);
    border-bottom-color: #cbd5e1;
    background: none;
}

.ts-tabs .nav-link.active {
    color: var(--ts-primary);
    border-bottom-color: var(--ts-primary);
    background: none;
}

.ts-tabs .nav-link i {
    margin-left: 6px;
}

.ts-tabs .nav-link .badge {
    margin-right: 6px;
    font-size: 0.65rem;
}

/* ===================================================
   ACCORDION
   =================================================== */
.ts-accordion .accordion-item {
    border: 1px solid var(--ts-border);
    margin-bottom: -1px;
}

.ts-accordion .accordion-item:first-child {
    border-radius: var(--ts-radius) var(--ts-radius) 0 0;
}

.ts-accordion .accordion-item:last-child {
    border-radius: 0 0 var(--ts-radius) var(--ts-radius);
    margin-bottom: 0;
}

.ts-accordion .accordion-button {
    font-family: var(--ts-font);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ts-text);
    padding: 14px 20px;
    box-shadow: none;
}

.ts-accordion .accordion-button:not(.collapsed) {
    background: #f8fafc;
    color: var(--ts-primary);
}

.ts-accordion .accordion-body {
    font-size: 0.85rem;
    padding: 16px 20px;
    color: var(--ts-text);
    line-height: 1.8;
}

/* ===================================================
   PROGRESS BAR
   =================================================== */
.ts-progress {
    height: 8px;
    border-radius: 4px;
    background: #e2e8f0;
    overflow: hidden;
}

.ts-progress-bar {
    height: 100%;
    border-radius: 4px;
    background: var(--ts-primary);
    transition: width 0.4s ease;
}

.ts-progress-bar.success { background: var(--ts-success); }
.ts-progress-bar.danger  { background: var(--ts-danger); }
.ts-progress-bar.warning { background: var(--ts-warning); }
.ts-progress-bar.info    { background: var(--ts-info); }

.ts-progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.ts-progress-label span:last-child {
    color: var(--ts-text-muted);
    font-weight: 400;
}

/* ===================================================
   DESCRIPTION LIST (Key-Value Detail)
   =================================================== */
.ts-detail-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ts-detail-list li {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.85rem;
    gap: 12px;
}

.ts-detail-list li:last-child {
    border-bottom: none;
}

.ts-detail-list .ts-detail-key {
    color: var(--ts-text-muted);
    min-width: 120px;
    flex-shrink: 0;
    font-weight: 500;
}

.ts-detail-list .ts-detail-value {
    color: var(--ts-text);
    font-weight: 600;
}

/* ===================================================
   STEPS / WIZARD
   =================================================== */
.ts-steps {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: step;
}

.ts-steps li {
    flex: 1;
    text-align: center;
    position: relative;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ts-text-muted);
}

.ts-steps li::before {
    counter-increment: step;
    content: counter(step);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e2e8f0;
    color: var(--ts-secondary);
    font-weight: 700;
    font-size: 0.85rem;
    margin: 0 auto 8px;
    position: relative;
    z-index: 1;
    transition: all 0.2s;
}

.ts-steps li::after {
    content: '';
    position: absolute;
    top: 18px;
    right: 50%;
    width: 100%;
    height: 2px;
    background: #e2e8f0;
    z-index: 0;
}

.ts-steps li:first-child::after {
    display: none;
}

.ts-steps li.active::before {
    background: var(--ts-primary);
    color: #fff;
}

.ts-steps li.active {
    color: var(--ts-primary);
}

.ts-steps li.completed::before {
    background: var(--ts-success);
    color: #fff;
    content: '\2713';
}

.ts-steps li.completed::after {
    background: var(--ts-success);
}

.ts-steps li.completed {
    color: var(--ts-success);
}

/* ===================================================
   INPUT GROUP ADDONS
   =================================================== */
.ts-input-group .input-group-text {
    font-family: var(--ts-font);
    font-size: 0.82rem;
    background: #f8fafc;
    border-color: var(--ts-border);
    color: var(--ts-secondary);
    min-width: 44px;
    justify-content: center;
}

/* ===================================================
   LIST GROUP (Activity / Recent)
   =================================================== */
.ts-list-group {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ts-list-group-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.85rem;
}

.ts-list-group-item:last-child {
    border-bottom: none;
}

.ts-list-group-item .ts-list-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.ts-list-group-item .ts-list-body {
    flex: 1;
    min-width: 0;
}

.ts-list-group-item .ts-list-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--ts-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ts-list-group-item .ts-list-sub {
    font-size: 0.75rem;
    color: var(--ts-text-muted);
}

.ts-list-group-item .ts-list-extra {
    font-size: 0.75rem;
    color: var(--ts-text-muted);
    text-align: left;
    flex-shrink: 0;
}

/* ===================================================
   AVATAR
   =================================================== */
.ts-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ts-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.ts-avatar.sm { width: 28px; height: 28px; font-size: 0.65rem; }
.ts-avatar.md { width: 40px; height: 40px; font-size: 0.85rem; }
.ts-avatar.lg { width: 56px; height: 56px; font-size: 1.1rem; }
.ts-avatar.xl { width: 72px; height: 72px; font-size: 1.4rem; }

.ts-avatar-group {
    display: flex;
    flex-direction: row-reverse;
}

.ts-avatar-group .ts-avatar {
    border: 2px solid #fff;
    margin-left: -10px;
}

.ts-avatar-group .ts-avatar:last-child {
    margin-left: 0;
}

/* ===================================================
   NOTIFICATION DROPDOWN
   =================================================== */
.ts-notification-menu {
    width: 340px;
    padding: 0;
    border: 1px solid var(--ts-border);
    box-shadow: var(--ts-shadow-lg);
    border-radius: var(--ts-radius);
}

.ts-notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--ts-border);
    font-size: 0.88rem;
    font-weight: 700;
}

.ts-notification-header a {
    font-size: 0.75rem;
    font-weight: 400;
}

.ts-notification-list {
    max-height: 300px;
    overflow-y: auto;
}

.ts-notification-item {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #f8fafc;
    font-size: 0.82rem;
    transition: background 0.15s;
    cursor: pointer;
}

.ts-notification-item:hover {
    background: #f8fafc;
}

.ts-notification-item.unread {
    background: #eff6ff;
}

.ts-notification-item .ts-notif-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.ts-notification-item .ts-notif-body {
    flex: 1;
    min-width: 0;
}

.ts-notification-item .ts-notif-text {
    color: var(--ts-text);
    line-height: 1.5;
}

.ts-notification-item .ts-notif-time {
    font-size: 0.7rem;
    color: var(--ts-text-muted);
    margin-top: 2px;
}

.ts-notification-footer {
    text-align: center;
    padding: 10px;
    border-top: 1px solid var(--ts-border);
}

.ts-notification-footer a {
    font-size: 0.8rem;
    font-weight: 600;
}

/* ===================================================
   INVOICE / RECEIPT PREVIEW
   =================================================== */
.ts-invoice {
    background: #fff;
    border: 1px solid var(--ts-border);
    border-radius: var(--ts-radius);
    padding: 32px;
    max-width: 700px;
    margin: 0 auto;
}

.ts-invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--ts-dark);
}

.ts-invoice-brand h3 {
    font-size: 1.2rem;
    font-weight: 800;
    margin: 0;
    color: var(--ts-dark);
}

.ts-invoice-brand p {
    font-size: 0.75rem;
    color: var(--ts-text-muted);
    margin: 2px 0 0;
}

.ts-invoice-meta {
    text-align: left;
    font-size: 0.82rem;
}

.ts-invoice-meta div {
    margin-bottom: 4px;
}

.ts-invoice-meta strong {
    color: var(--ts-text);
}

.ts-invoice-parties {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
}

.ts-invoice-party {
    flex: 1;
    background: #f8fafc;
    border-radius: var(--ts-radius);
    padding: 14px 16px;
    font-size: 0.82rem;
}

.ts-invoice-party h6 {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--ts-text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
}

.ts-invoice-table {
    width: 100%;
    margin-bottom: 20px;
    border-collapse: collapse;
}

.ts-invoice-table thead th {
    background: var(--ts-dark);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 10px 14px;
    text-align: right;
}

.ts-invoice-table thead th:first-child {
    border-radius: 0 var(--ts-radius) var(--ts-radius) 0;
}

.ts-invoice-table thead th:last-child {
    border-radius: var(--ts-radius) 0 0 var(--ts-radius);
}

.ts-invoice-table tbody td {
    padding: 10px 14px;
    font-size: 0.82rem;
    border-bottom: 1px solid #f1f5f9;
}

.ts-invoice-total {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

.ts-invoice-total table {
    min-width: 240px;
}

.ts-invoice-total td {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.ts-invoice-total tr:last-child td {
    font-weight: 800;
    font-size: 1rem;
    border-top: 2px solid var(--ts-dark);
    padding-top: 10px;
    color: var(--ts-dark);
}

.ts-invoice-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--ts-border);
    text-align: center;
    font-size: 0.75rem;
    color: var(--ts-text-muted);
}

/* ===================================================
   OFFCANVAS (Filter Panel)
   =================================================== */
.ts-offcanvas .offcanvas-header {
    border-bottom: 1px solid var(--ts-border);
    padding: 16px 20px;
}

.ts-offcanvas .offcanvas-title {
    font-family: var(--ts-font);
    font-size: 1rem;
    font-weight: 700;
}

.ts-offcanvas .offcanvas-body {
    padding: 20px;
    font-family: var(--ts-font);
}

/* ===================================================
   DROPDOWN ACTIONS
   =================================================== */
.ts-dropdown-actions .dropdown-item {
    font-family: var(--ts-font);
    font-size: 0.82rem;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ts-dropdown-actions .dropdown-item i {
    width: 18px;
    text-align: center;
    color: var(--ts-secondary);
}

.ts-dropdown-actions .dropdown-item:hover i {
    color: inherit;
}

.ts-dropdown-actions .dropdown-divider {
    margin: 4px 0;
}

/* ===================================================
   DARK THEME
   =================================================== */
[data-theme="dark"] {
    --ts-dark: #e2e8f0;
    --ts-light: #1e293b;
    --ts-border: #334155;
    --ts-text: #cbd5e1;
    --ts-text-muted: #64748b;
    --ts-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --ts-shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] body {
    background: #0f172a;
    color: #cbd5e1;
}

[data-theme="dark"] .ts-sidebar {
    background: #0c1222;
    border-left: 1px solid #1e293b;
}

[data-theme="dark"] .ts-sidebar-brand {
    border-bottom-color: #1e293b;
}

[data-theme="dark"] .ts-sidebar-footer {
    border-top-color: #1e293b;
}

[data-theme="dark"] .ts-sidebar-nav .ts-submenu {
    background: rgba(0,0,0,0.3);
}

[data-theme="dark"] .ts-navbar {
    background: #1e293b;
    border-bottom-color: #334155;
}

[data-theme="dark"] .ts-navbar .ts-nav-icon:hover {
    background: #334155;
}

[data-theme="dark"] .ts-user-menu:hover {
    background: #334155;
}

[data-theme="dark"] .ts-user-info .name {
    color: #e2e8f0;
}

[data-theme="dark"] .ts-card,
[data-theme="dark"] .ts-stat-card {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .ts-card-header {
    border-bottom-color: #334155;
}

[data-theme="dark"] .ts-card-footer {
    background: #172033;
    border-top-color: #334155;
}

[data-theme="dark"] .ts-table thead th {
    background: #172033;
    border-bottom-color: #334155;
    color: #94a3b8;
}

[data-theme="dark"] .ts-table tbody td {
    border-bottom-color: #334155;
}

[data-theme="dark"] .ts-table tbody tr:hover {
    background: #172033;
}

[data-theme="dark"] .ts-card-list-item {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .ts-card-list-item .ts-card-list-actions {
    border-top-color: #334155;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background: #0f172a;
    border-color: #334155;
    color: #cbd5e1;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background: #0f172a;
    border-color: var(--ts-primary);
    color: #e2e8f0;
}

[data-theme="dark"] .form-control::placeholder {
    color: #475569;
}

[data-theme="dark"] .form-check-input {
    background-color: #334155;
    border-color: #475569;
}

[data-theme="dark"] .form-check-input:checked {
    background-color: var(--ts-primary);
    border-color: var(--ts-primary);
}

[data-theme="dark"] .ts-file-upload {
    border-color: #334155;
    background: #0f172a;
}

[data-theme="dark"] .ts-file-upload:hover,
[data-theme="dark"] .ts-file-upload.dragover {
    background: #172033;
}

[data-theme="dark"] .btn-light {
    background: #334155;
    border-color: #475569;
    color: #e2e8f0;
}

[data-theme="dark"] .btn-light:hover {
    background: #475569;
}

[data-theme="dark"] .btn-outline-primary,
[data-theme="dark"] .btn-outline-secondary {
    border-color: #475569;
}

[data-theme="dark"] .modal-content {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .modal-header {
    border-bottom-color: #334155;
}

[data-theme="dark"] .modal-footer {
    border-top-color: #334155;
}

[data-theme="dark"] .alert {
    border: none;
}

[data-theme="dark"] .ts-toast {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .ts-timeline-item .ts-timeline-body {
    background: #172033;
    border-color: #334155;
}

[data-theme="dark"] .ts-timeline::before {
    background: #334155;
}

[data-theme="dark"] .ts-empty i {
    color: #475569;
}

[data-theme="dark"] .ts-loading-overlay {
    background: rgba(15, 23, 42, 0.8);
}

[data-theme="dark"] .ts-skeleton {
    background: linear-gradient(90deg, #334155 25%, #475569 50%, #334155 75%);
    background-size: 200% 100%;
    animation: tsShimmer 1.5s infinite;
}

[data-theme="dark"] .ts-bottom-nav {
    background: #1e293b;
    border-top-color: #334155;
}

[data-theme="dark"] .dropdown-menu {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .dropdown-item {
    color: #cbd5e1;
}

[data-theme="dark"] .dropdown-item:hover {
    background: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .dropdown-divider {
    border-top-color: #334155;
}

[data-theme="dark"] .ts-pagination .page-link {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}

[data-theme="dark"] .ts-pagination .page-item.active .page-link {
    background: var(--ts-primary);
    border-color: var(--ts-primary);
    color: #fff;
}

[data-theme="dark"] .badge.bg-light {
    background: #334155 !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .ts-detail-list li {
    border-bottom-color: #334155;
}

[data-theme="dark"] .ts-list-group-item {
    border-bottom-color: #334155;
}

[data-theme="dark"] .ts-accordion .accordion-button {
    background: #1e293b;
    color: #cbd5e1;
}

[data-theme="dark"] .ts-accordion .accordion-button:not(.collapsed) {
    background: #172033;
    color: var(--ts-primary);
}

[data-theme="dark"] .ts-accordion .accordion-body {
    background: #1e293b;
    color: #cbd5e1;
}

[data-theme="dark"] .ts-accordion .accordion-item {
    border-color: #334155;
    background: #1e293b;
}

[data-theme="dark"] .ts-progress {
    background: #334155;
}

[data-theme="dark"] .ts-steps li::before {
    background: #334155;
    color: #94a3b8;
}

[data-theme="dark"] .ts-steps li::after {
    background: #334155;
}

[data-theme="dark"] .ts-invoice {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .ts-invoice-header {
    border-bottom-color: #e2e8f0;
}

[data-theme="dark"] .ts-invoice-party {
    background: #172033;
}

[data-theme="dark"] .ts-invoice-table thead th {
    background: #e2e8f0;
    color: #1e293b;
}

[data-theme="dark"] .ts-invoice-table tbody td {
    border-bottom-color: #334155;
}

[data-theme="dark"] .ts-invoice-footer {
    border-top-color: #334155;
}

[data-theme="dark"] .ts-notification-menu {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .ts-notification-header {
    border-bottom-color: #334155;
}

[data-theme="dark"] .ts-notification-item {
    border-bottom-color: #334155;
}

[data-theme="dark"] .ts-notification-item:hover {
    background: #172033;
}

[data-theme="dark"] .ts-notification-item.unread {
    background: rgba(37, 99, 235, 0.1);
}

[data-theme="dark"] .ts-notification-footer {
    border-top-color: #334155;
}

[data-theme="dark"] .ts-offcanvas .offcanvas-header {
    border-bottom-color: #334155;
}

[data-theme="dark"] .offcanvas {
    background: #1e293b;
    color: #cbd5e1;
}

[data-theme="dark"] .ts-input-group .input-group-text {
    background: #172033;
    border-color: #334155;
    color: #94a3b8;
}

/* Theme toggle button */
.ts-theme-toggle {
    position: relative;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--ts-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ts-theme-toggle:hover {
    background: #f1f5f9;
    color: var(--ts-text);
}

[data-theme="dark"] .ts-theme-toggle:hover {
    background: #334155;
}

.ts-theme-toggle .bi-sun-fill { display: none; }
.ts-theme-toggle .bi-moon-fill { display: inline; }

[data-theme="dark"] .ts-theme-toggle .bi-sun-fill { display: inline; }
[data-theme="dark"] .ts-theme-toggle .bi-moon-fill { display: none; }

/* ===================================================
   PRINT
   =================================================== */
@media print {
    .ts-sidebar,
    .ts-navbar,
    .ts-bottom-nav,
    .ts-page-actions,
    .ts-toast-container {
        display: none !important;
    }

    .ts-main {
        margin: 0 !important;
        padding: 0 !important;
    }

    .ts-content {
        padding: 0 !important;
    }

    .ts-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    body {
        background: #fff;
    }
}
