/* ==========================================
   LOGİSTİKA CRM — Professional Light Theme
   ========================================== */

:root {
    --primary: #3b82f6;
    --primary-light: #eff6ff;
    --primary-dark: #2563eb;
    --secondary: #64748b;
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --info: #06b6d4;
    --info-light: #ecfeff;
    --body-bg: #f1f5f9;
    --card-bg: #ffffff;
    --sidebar-bg: #ffffff;
    --sidebar-width: 260px;
    --header-height: 60px;
    --text-dark: #1e293b;
    --text-muted: #94a3b8;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 1px 8px rgba(0, 0, 0, 0.06);
    --radius: 8px;
    --radius-lg: 12px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--body-bg);
    color: var(--text-dark);
    margin: 0;
    padding: 0;
    font-size: 14px;
    line-height: 1.5;
}

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

/* ==========================================
   SIDEBAR
   ========================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
    gap: 10px;
}

.sidebar-brand .brand-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.sidebar-brand .brand-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px 0 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 8px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
    border: 2px solid var(--sidebar-bg);
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.nav-section {
    padding: 8px 20px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 7px 20px;
    margin: 1px 8px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.15s ease;
    gap: 12px;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--body-bg);
    color: var(--text-dark);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 15px;
    flex-shrink: 0;
}

.nav-item .badge {
    margin-left: auto;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

/* Nav Dropdown */
.nav-dropdown {
    display: block;
}
.nav-dropdown > .nav-item {
    position: relative;
}
.nav-dropdown > .nav-item .nav-arrow {
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.2s ease;
    width: auto !important;
    text-align: right !important;
}
.nav-dropdown.open > .nav-item .nav-arrow {
    transform: rotate(180deg);
}
.nav-dropdown-menu {
    display: none;
    overflow: hidden;
    padding: 2px 0 6px 0;
}
.nav-dropdown.open > .nav-dropdown-menu {
    display: block;
}
a.nav-sub-item {
    display: block !important;
    padding: 5px 20px 5px 52px;
    margin: 1px 8px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 400;
    line-height: 1.35;
    text-decoration: none;
    transition: all 0.15s ease;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
a.nav-sub-item::before {
    content: '';
    position: absolute;
    left: 32px;
    top: 50%;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--border-color);
    transform: translateY(-50%);
}
a.nav-sub-item:hover {
    background: var(--body-bg);
    color: var(--text-dark);
}
a.nav-sub-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}
a.nav-sub-item.active::before {
    background: var(--primary);
}

/* ==========================================
   HEADER
   ========================================== */

/* Top Bar */
.top-bar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: 36px;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
    font-size: 12px;
    color: #cbd5e1;
}

.top-bar-left,
.top-bar-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.top-bar-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.top-bar-item i {
    font-size: 11px;
    opacity: 0.7;
}

.top-bar-divider {
    width: 1px;
    height: 14px;
    background: rgba(255,255,255,0.15);
    margin: 0 6px;
}

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

.currency-item span[id^="rate"] {
    color: #67e8f9;
    font-weight: 700;
}

.currency-flag {
    font-size: 13px;
    line-height: 1;
}

.main-header {
    position: fixed;
    top: 36px;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 999;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-left h1 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: var(--text-dark);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: background 0.15s;
}

.header-user:hover {
    background: var(--body-bg);
}

.header-user .avatar {
    width: 34px;
    height: 34px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
}

.header-user .user-info {
    line-height: 1.3;
}

.header-user .user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
}

.header-user .user-role {
    font-size: 11px;
    color: var(--text-muted);
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
}

/* ==========================================
   MAIN CONTENT
   ========================================== */
.main-content {
    margin-left: var(--sidebar-width);
    padding-top: calc(var(--header-height) + 36px);
    min-height: 100vh;
}

.content-wrapper {
    padding: 24px;
}

/* ==========================================
   CARDS
   ========================================== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h5,
.card-header h6 {
    margin: 0;
    font-weight: 600;
}

.card-body { padding: 20px; }

/* ==========================================
   STAT CARDS
   ========================================== */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease;
    border-left: 4px solid var(--primary);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-card.success { border-left-color: var(--success); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.danger { border-left-color: var(--danger); }
.stat-card.info { border-left-color: var(--info); }
.stat-card.secondary { border-left-color: var(--secondary); }

.stat-info .stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-info .stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
    margin-top: 4px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-icon.primary { background: var(--primary-light); color: var(--primary); }
.stat-icon.success { background: var(--success-light); color: var(--success); }
.stat-icon.warning { background: var(--warning-light); color: var(--warning); }
.stat-icon.danger { background: var(--danger-light); color: var(--danger); }
.stat-icon.info { background: var(--info-light); color: var(--info); }
.stat-icon.secondary { background: #f1f5f9; color: var(--secondary); }

/* ==========================================
   TABLE
   ========================================== */
.table-wrapper {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13.5px;
}

.table thead th {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 13px 18px;
    text-align: left;
    font-weight: 700;
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.table thead th:first-child {
    border-radius: 8px 0 0 0;
}

.table thead th:last-child {
    border-radius: 0 8px 0 0;
}

.table tbody td {
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    color: var(--text-dark);
    transition: all 0.15s ease;
}

.table tbody tr {
    transition: all 0.15s ease;
}

.table tbody tr:hover {
    background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
    transform: scale(1.001);
}

.table tbody tr:hover td {
    color: var(--text-dark);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Yalnız sıx maliyyə cədvəllərində daha aydın sətir ayırıcısı. */
.table.table-row-lines tbody td,
.table.table-row-lines tbody tr:last-child td {
    border-bottom: 1px solid #cbd5e1;
}

.table tbody tr:nth-child(even) {
    background-color: #fafbfc;
}

.table tbody tr:nth-child(even):hover {
    background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
}

/* Table row number styling */
.table tbody td:first-child {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
}

/* Table action buttons alignment */
.table .btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.table .btn-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.12);
}

/* Empty state inside tables */
.table + .text-center,
.card-body > div[style*="text-align:center"] {
    padding: 50px 20px;
}

/* ==========================================
   BADGES / STATUS
   ========================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.2px;
    transition: all 0.15s ease;
}

.badge-success { background: var(--success-light); color: #059669; border: 1px solid #d1fae5; }
.badge-warning { background: var(--warning-light); color: #d97706; border: 1px solid #fef3c7; }
.badge-danger { background: var(--danger-light); color: #dc2626; border: 1px solid #fecaca; }
.badge-info { background: var(--info-light); color: #0891b2; border: 1px solid #cffafe; }
.badge-primary { background: var(--primary-light); color: var(--primary); border: 1px solid #dbeafe; }
.badge-secondary { background: #f1f5f9; color: var(--secondary); border: 1px solid var(--border-color); }

/* Bootstrap-uyğun `badge bg-*` sinifləri (status badge-ləri üçün) — yumşaq, oxunaqlı, fərqli rənglər.
   Bütün app boyu `<span class="badge bg-...">` istifadələrini rəngləndirir. */
.badge.bg-secondary { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.badge.bg-primary   { background: #dbeafe; color: #2563eb; border: 1px solid #bfdbfe; }
.badge.bg-info      { background: #cffafe; color: #0e7490; border: 1px solid #a5f3fc; }
.badge.bg-warning   { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.badge.bg-success   { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.badge.bg-danger    { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.badge.bg-purple    { background: #ede9fe; color: #6d28d9; border: 1px solid #ddd6fe; }
.badge.bg-indigo    { background: #e0e7ff; color: #4338ca; border: 1px solid #c7d2fe; }
.badge.bg-teal      { background: #ccfbf1; color: #0f766e; border: 1px solid #99f6e4; }
.badge.bg-dark      { background: #e5e7eb; color: #374151; border: 1px solid #d1d5db; }

/* ==========================================
   STATUS TABS
   ========================================== */
.status-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.status-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    text-decoration: none;
    transition: all 0.2s ease;
}

.status-tab:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: #bfdbfe;
}

.status-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.status-tab .tab-count {
    background: rgba(0, 0, 0, 0.08);
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

.status-tab.active .tab-count {
    background: rgba(255, 255, 255, 0.25);
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; color: #fff; }

.btn-secondary { background: #e2e8f0; color: var(--text-secondary); }
.btn-secondary:hover { background: #cbd5e1; color: var(--text-dark); }

.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-secondary); }
.btn-outline:hover { background: var(--body-bg); color: var(--text-dark); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 10px 24px; font-size: 15px; }

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

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

/* ==========================================
   FORMS
   ========================================== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-dark);
    background: var(--card-bg);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.is-invalid {
    border-color: var(--danger) !important;
}

.invalid-feedback {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
}

/* ==========================================
   PAGE HEADER
   ========================================== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h4 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.page-header .breadcrumb {
    font-size: 13px;
    color: var(--text-muted);
    margin: 4px 0 0;
}

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

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

/* ==========================================
   PAGINATION
   ========================================== */
.pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

.pagination-info {
    font-size: 13px;
    color: var(--text-muted);
}

.pagination {
    display: flex;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.pagination .page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s ease;
}

.pagination .page-item .page-link:hover {
    background: var(--body-bg);
}

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

.pagination .page-item.disabled .page-link {
    opacity: 0.4;
    pointer-events: none;
}

/* ==========================================
   ALERTS
   ========================================== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: var(--success-light); color: #059669; border: 1px solid #a7f3d0; }
.alert-danger { background: var(--danger-light); color: #dc2626; border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: #d97706; border: 1px solid #fde68a; }
.alert-info { background: var(--info-light); color: #0891b2; border: 1px solid #a5f3fc; }

/* ==========================================
   MODAL
   ========================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-backdrop.show {
    display: flex;
}

.modal-dialog {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 480px;
    margin: 20px;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h5 { margin: 0; font-size: 16px; font-weight: 600; }

.modal-body { padding: 20px; }

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* ==========================================
   LOGIN PAGE
   ========================================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--body-bg);
}

.login-container {
    display: flex;
    width: 100%;
    max-width: 960px;
    min-height: 580px;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin: 24px;
    border: 1px solid var(--border-color);
}

.login-info-panel {
    flex: 1;
    background: linear-gradient(135deg, #1e3a5f 0%, #0f2440 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
    position: relative;
    overflow: hidden;
}

.login-info-panel::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%;
}

.login-info-panel::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: -40px;
    width: 240px;
    height: 240px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 50%;
}

.login-info-content {
    position: relative;
    z-index: 1;
    width: 100%;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 8px;
}

.login-brand-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.login-brand h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    letter-spacing: 1px;
}

.login-tagline {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin: 0 0 36px;
}

.login-features {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-feature {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.login-feature .feature-icon {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.8);
}

.login-feature strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
}

.login-feature span {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.4;
}

.login-footer-text {
    margin-top: 40px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.3);
}

.login-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
}

.login-form-content {
    width: 100%;
    max-width: 340px;
}

.login-form-header {
    margin-bottom: 28px;
}

.login-form-header h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--text-dark);
}

.login-form-header p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

/* Legacy support */
.login-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border-color);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .logo-icon {
    width: 56px;
    height: 56px;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 12px;
}

.login-logo h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    color: var(--text-dark);
}

.login-logo p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 4px 0 0;
}

@media (max-width: 768px) {
    .login-container {
        flex-direction: column;
        max-width: 480px;
        min-height: auto;
    }
    .login-info-panel {
        padding: 32px 28px;
    }
    .login-features {
        display: none;
    }
    .login-footer-text {
        display: none;
    }
    .login-form-panel {
        padding: 32px 28px;
    }
}

/* ==========================================
   GRID HELPERS
   ========================================== */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -12px;
}

.col { flex: 1; padding: 0 12px; }
.col-6 { width: 50%; padding: 0 12px; }
.col-4 { width: 33.333%; padding: 0 12px; }
.col-3 { width: 25%; padding: 0 12px; }
.col-2 { width: 16.666%; padding: 0 12px; }
.col-8 { width: 66.666%; padding: 0 12px; }
.col-12 { width: 100%; padding: 0 12px; }

.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

/* ==========================================
   SEARCH SELECT
   ========================================== */
.search-select {
    position: relative;
}

.search-select .ss-display {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-dark);
    background: var(--card-bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    min-height: 38px;
}

.search-select .ss-display:hover { border-color: var(--primary); }
.search-select.open .ss-display { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }

.search-select .ss-placeholder { color: var(--text-muted); }

.search-select .ss-arrow {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.15s ease;
    margin-left: 8px;
    flex-shrink: 0;
}

.search-select.open .ss-arrow { transform: rotate(180deg); }

.search-select .ss-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: var(--shadow-md);
    z-index: 1050;
    display: none;
    max-height: 260px;
    overflow: hidden;
}

.search-select.open .ss-dropdown { display: block; }

.search-select .ss-search {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
}

.search-select .ss-search input {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
}

.search-select .ss-search input:focus {
    border-color: var(--primary);
}

.search-select .ss-options {
    max-height: 200px;
    overflow-y: auto;
    padding: 4px;
}

.search-select .ss-option {
    padding: 8px 10px;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
    color: var(--text-secondary);
    transition: background 0.1s ease;
}

.search-select .ss-option:hover { background: var(--body-bg); color: var(--text-dark); }
.search-select .ss-option.selected { background: var(--primary-light); color: var(--primary); font-weight: 500; }
.search-select .ss-option.hidden { display: none; }
.search-select .ss-no-result { padding: 12px 10px; font-size: 13px; color: var(--text-muted); text-align: center; display: none; }

/* ==========================================
   PASSWORD TOGGLE
   ========================================== */
.password-wrapper {
    position: relative;
}
.password-wrapper .form-control {
    padding-right: 40px;
}
.password-wrapper .toggle-password {
    position: absolute;
    right: 1px;
    top: 1px;
    bottom: 1px;
    width: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    border-radius: 0 5px 5px 0;
    transition: color 0.15s ease;
}
.password-wrapper .toggle-password:hover {
    color: var(--text-dark);
}

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

.empty-state i {
    font-size: 48px;
    color: var(--border-color);
    margin-bottom: 16px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 14px;
}

/* ==========================================
   ACTION BUTTONS GROUP
   ========================================== */
.action-btns {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .top-bar {
        left: 0;
    }

    .main-header {
        left: 0;
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
    }

    .top-bar-right {
        display: none;
    }
}

@media (max-width: 768px) {
    .col-6, .col-4, .col-3, .col-2, .col-8 {
        width: 100%;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .content-wrapper {
        padding: 16px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-info .stat-value {
        font-size: 22px;
    }
}

/* ==========================================
   TABLE FILTER — Excel-like filter system
   ========================================== */
.tf-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 16px; border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
    border-radius: var(--radius) var(--radius) 0 0;
}
.tf-toolbar + .table-wrapper { border-radius: 0; }
.tf-toolbar + .table-wrapper .table { border-radius: 0; }
.tf-toolbar-left { display: flex; align-items: center; gap: 12px; }
.tf-toolbar-right { display: flex; align-items: center; gap: 8px; }
.tf-count { font-size: 13px; color: var(--text-muted); }
.tf-count strong { color: var(--text-dark); font-weight: 700; }

.tf-filter-row th {
    padding: 4px 6px !important;
    background: var(--body-bg) !important;
    border-bottom: 2px solid var(--primary) !important;
}
.tf-input {
    width: 100%; padding: 4px 8px; font-size: 12px;
    border: 1px solid var(--border-color); border-radius: 4px;
    background: var(--card-bg); color: var(--text-dark);
    outline: none; transition: border-color .15s;
}
.tf-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79,70,229,0.1); }
.tf-select { cursor: pointer; }
.tf-date { min-width: 0; padding: 3px 4px; font-size: 11px; }
.tf-sort-icon { transition: opacity .15s; }

th[data-sort]:not([data-sort="none"]):hover { background: rgba(79,70,229,0.04); }

.tf-pagination {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 16px; background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius) var(--radius);
}
.tf-page-info { font-size: 12px; color: var(--text-muted); }
.tf-page-nav { display: flex; align-items: center; gap: 2px; }
.tf-page-btn {
    min-width: 32px; height: 32px; padding: 0 8px;
    border: 1px solid var(--border-color); border-radius: 6px;
    background: var(--card-bg); color: var(--text-secondary);
    font-size: 12px; font-weight: 500; cursor: pointer; transition: all .15s;
    display: flex; align-items: center; justify-content: center;
}
.tf-page-btn:hover:not(:disabled):not(.active) { background: var(--body-bg); border-color: var(--primary); color: var(--primary); }
.tf-page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tf-page-btn:disabled { opacity: 0.4; cursor: default; }
.tf-page-dots { padding: 0 4px; color: var(--text-muted); font-size: 12px; }

/* ==========================================
   CREATE / SHOW / EDIT — POLISH LAYER
   (global additive styles — no markup changes required)
   ========================================== */

/* Page header: tighter, clearer hierarchy, subtle divider */
.page-header {
    padding-bottom: 14px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}
.page-header h4 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-dark);
}
.page-header .breadcrumb {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}
.page-header .breadcrumb a {
    color: var(--text-muted);
    transition: color 0.15s ease;
}
.page-header .breadcrumb a:hover { color: var(--primary); }

/* Card: firmer edges, clearer header, optional icon styling */
.card {
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.card:hover {
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}
.card + .card { margin-top: 16px; }
.card-header {
    padding: 12px 18px;
    background: #fafbfc;
    border-bottom: 1px solid var(--border-color);
    border-radius: 10px 10px 0 0;
}
.card-header h5,
.card-header h6 {
    font-size: 13px;
    letter-spacing: 0.01em;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-header h6 { font-weight: 600; }
.card-header h6 > i,
.card-header h5 > i {
    font-size: 12px;
    opacity: 0.85;
}
.card-body { padding: 18px 20px; }
.card > form > .card-body:last-of-type,
.card-body:last-child { border-radius: 0 0 10px 10px; }

/* Form: tighter vertical rhythm, clearer labels, required asterisk */
.form-group { margin-bottom: 14px; }
.form-label {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 5px;
    letter-spacing: 0.01em;
}
.form-label .text-danger,
.form-label em.req { color: var(--danger); margin-left: 2px; }
.form-control {
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.form-control:hover:not(:focus):not(:disabled):not([readonly]) {
    border-color: #cbd5e1;
}
.form-control:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
.form-control:disabled,
.form-control[readonly] {
    background: #f8fafc;
    color: var(--text-secondary);
    cursor: not-allowed;
}
.form-text { font-size: 11.5px; margin-top: 3px; }
.invalid-feedback { font-size: 11.5px; margin-top: 4px; }

/* Form footer actions — targets the common inline-styled button row at end of forms */
.card form > div[style*="display:flex"][style*="margin-top"]:last-child,
.card-body > form > div[style*="display:flex"][style*="margin-top"]:last-child,
.form-actions {
    padding-top: 16px !important;
    margin-top: 20px !important;
    border-top: 1px solid var(--border-color);
    gap: 8px !important;
    display: flex !important;
    align-items: center;
}

/* Detail table — global defaults (per-page pushed styles can override) */
.detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.detail-table tr { border-bottom: 1px solid #f1f5f9; }
.detail-table tr:last-child { border-bottom: none; }
.detail-table td {
    padding: 9px 0;
    vertical-align: top;
    line-height: 1.5;
}
.detail-label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    padding-right: 12px;
    max-width: 180px;
}
.detail-value {
    color: var(--text-dark);
    font-weight: 500;
    word-break: break-word;
}

/* Badges: consistent vertical alignment & spacing when multiple shown */
.detail-value .badge + .badge,
.detail-table .badge + .badge { margin-left: 4px; margin-top: 2px; }

/* Buttons: firmer resting state, subtle lift on primary actions */
.btn {
    font-weight: 500;
    letter-spacing: 0.005em;
}
.btn-primary {
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.15);
}
.btn-primary:hover {
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}
.btn-secondary {
    background: #f1f5f9;
    color: var(--text-secondary);
}
.btn-secondary:hover {
    background: #e2e8f0;
    color: var(--text-dark);
}
.btn-danger { box-shadow: 0 1px 2px rgba(239, 68, 68, 0.15); }
.btn-danger:hover { box-shadow: 0 2px 6px rgba(239, 68, 68, 0.25); }
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

/* Auto-scroll to first invalid field */
.form-control.is-invalid { scroll-margin-top: 100px; }

/* TomSelect: prevent wrapper from double-applying form-control box
   (TomSelect copies the original select's class to the wrapper, which
   otherwise stacks padding+border with the inner .ts-control) */
.ts-wrapper.form-control {
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    min-height: 0 !important;
    height: auto !important;
    box-shadow: none !important;
}
.ts-wrapper.form-control:focus-within { box-shadow: none !important; }

/* Section heading within a card-body (subtle divider for grouping fields) */
.card-body .section-title,
.card-body > h6.subhead {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding-bottom: 8px;
    margin: 4px 0 14px;
    border-bottom: 1px solid var(--border-color);
}
.card-body .section-title + .row,
.card-body > h6.subhead + .row { margin-top: 0; }

/* Grid helpers used by show pages (inline grid blocks) – ensure consistent gap on narrow screens */
@media (max-width: 900px) {
    [style*="grid-template-columns:1fr 1fr"],
    [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}
