/* style.css - Основные стили для личного кабинета */
:root {
    /* Light theme variables */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --border-light: rgba(0, 0, 0, 0.08);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --mobile-navbar-height: 56px;
}

[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --background: #0f172a;
    --card-bg: #1e293b;
    --text: #f1f5f9;
    --text-light: #94a3b8;
    --border: #334155;
    --border-light: rgba(255, 255, 255, 0.1);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text);
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===== MOBILE NAVBAR ===== */
.mobile-navbar {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1056;
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
}

/* Mobile navigation toggle - removed fixed positioning to prevent overlap with logo */

.mobile-navbar .mobile-brand {
    font-weight: 600;
    display: inline-flex;
    align-items: center;
}

.mobile-navbar .mobile-nav-toggle {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.mobile-navbar .mobile-nav-toggle:hover {
    background: var(--background);
    border-color: var(--primary);
    color: var(--primary);
}

@media (max-width: 991.98px) {
    .mobile-navbar { 
        display: flex; 
    }
    
    body.offcanvas-open .mobile-navbar { 
        z-index: 1056; 
    }
    
    .sidebar { 
        display: none !important; 
    }
    
    .main-content { 
        margin-left: 0 !important; 
        width: 100% !important; 
    }
    
    .mobile-navbar .mobile-brand img { 
        height: 40px; 
        width: auto; 
    }
    
    .offcanvas .offcanvas-header { 
        display: none !important; 
    }
    
    .offcanvas .offcanvas-body {
        padding-top: 12px;
    }
    
    .offcanvas { 
        top: calc(var(--mobile-navbar-height) + env(safe-area-inset-top)) !important;
        height: calc(100% - (var(--mobile-navbar-height) + env(safe-area-inset-top))) !important;
        border-top-left-radius: 12px;
        border-top-right-radius: 12px;
    }
    
    .offcanvas-backdrop { 
        top: calc(var(--mobile-navbar-height) + env(safe-area-inset-top));
        height: calc(100% - (var(--mobile-navbar-height) + env(safe-area-inset-top)));
    }
}

/* ===== SIDEBAR COLLAPSE BUTTON ===== */
.collapse-pretty {
    border-color: var(--border);
    background: linear-gradient(180deg, rgba(0,0,0,0.02), rgba(0,0,0,0.04));
    color: var(--text);
}

.collapse-pretty:hover {
    background: linear-gradient(180deg, rgba(0,0,0,0.04), rgba(0,0,0,0.08));
    border-color: var(--primary);
    color: var(--primary);
}

[data-theme="dark"] .collapse-pretty {
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
}

[data-theme="dark"] .collapse-pretty:hover {
    background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.04));
}

/* ===== LOGO STYLES ===== */
[data-theme="light"] .brand-logo-img {
    transform: scale(1.1);
    transform-origin: left center;
}

/* Логотип на странице входа - без масштабирования для сохранения пропорций */
[data-theme="light"] img.logo-login {
    transform: none;
}

/* ===== DATE INPUT CALENDAR ICON ===== */
/* General styles for all browsers */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    display: block;
    opacity: 1 !important;
    cursor: pointer;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    /* Light theme - make icon darker and more visible */
    filter: brightness(0.3) contrast(1.5);
}

/* Dark theme - make icon lighter and more visible */
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: brightness(1.8) contrast(1.3);
}

/* ===== SAFARI FALLBACK ===== */
@supports (-webkit-touch-callout: none) {
    input[type="date"],
    input[type="datetime-local"] {
        padding-right: 2rem;
        background-image: none !important;
    }
    
    /* Safari-specific adjustments */
    input[type="date"]::-webkit-calendar-picker-indicator,
    input[type="datetime-local"]::-webkit-calendar-picker-indicator {
        /* Light theme - darker for better visibility */
        filter: brightness(0.2) contrast(1.8);
    }
    
    [data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
    [data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator {
        filter: brightness(2.0) contrast(1.4);
    }
}

/* ===== MAIN LAYOUT STRUCTURE ===== */
.container-fluid {
    padding: 0;
    min-height: 100vh;
}

.row {
    margin: 0;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 250px;
    padding: 1rem 0.8rem;
    overflow-y: auto;
    z-index: 1000;
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
}

.logo {
    text-align: center;
    padding: 1rem 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.logo h1 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    margin: 0;
}

.brand-logo-img {
    height: 40px;
    width: auto;
    max-width: 100%;
    display: inline-block;
    object-fit: contain;
}

.sidebar-brand-text {
    margin-left: 0.5rem;
}

/* ===== USER INFO ===== */
.user-info {
    display: flex;
    align-items: center;
    padding: 1rem;
    margin-bottom: 1.5rem;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    margin-right: 12px;
}

.user-avatar i { 
    font-size: 1rem; 
}

.user-name {
    font-weight: bold;
    color: var(--text);
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.user-role {
    font-size: 0.8rem;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.user-company {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-top: 0.25rem;
}

/* ===== NAVIGATION MENU ===== */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.btn-sidebar {
    height: 44px;
    text-align: left;
    padding: 0 1rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    border-width: 1px;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    margin: 0;
    white-space: nowrap;
    text-decoration: none;
}

.btn-sidebar i {
    width: 24px;
    text-align: center;
    font-size: 0.95em;
    transition: transform 0.2s ease;
    margin-right: 0.5rem;
}

.btn-sidebar span {
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-sidebar:not(.active):hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.btn-sidebar.active {
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.btn-sidebar.active:after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 3px;
    height: 100%;
    background: currentColor;
    border-radius: 0 8px 8px 0;
}

/* Badge в sidebar */
.btn-sidebar .badge {
    font-size: 0.7rem;
    padding: 0.25em 0.5em;
    font-weight: 600;
    min-width: 20px;
}

/* ===== NAVIGATION FOOTER ===== */
.nav-footer {
    border-top: 1px solid var(--border-light);
    padding-top: 1rem;
    margin-top: auto;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: 250px;
    padding: 1.5rem;
    width: calc(100% - 250px);
    min-height: 100vh;
    transition: margin-left 0.3s ease, width 0.3s ease;
}

.content-wrapper {
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-top: 1rem;
}

/* ===== UTILITY CLASSES ===== */
.d-flex {
    display: flex;
}

.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.page-header h2 {
    margin: 0;
    color: var(--text);
    font-weight: 600;
}

.gap-2 {
    gap: 0.5rem;
}

.flex-fill {
    flex: 1 1 auto;
}

.ms-3 {
    margin-left: 1rem !important;
}

.justify-content-between {
    justify-content: space-between;
}

.align-items-center {
    align-items: center;
}

.border-bottom {
    border-bottom: 1px solid var(--border);
}

.mb-3 {
    margin-bottom: 1rem;
}

/* ===== DASHBOARD CARDS ===== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
}

.card-header {
    background-color: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
}

.card-body {
    padding: 1rem;
}

.card-title {
    margin-bottom: 0.5rem;
    color: var(--text);
}

.filters {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
}

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* ===== DRAG AND DROP STYLES ===== */
.stat-card {
    cursor: move;
    user-select: none;
}

.stat-card.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
    z-index: 1000;
    pointer-events: none;
}

.stat-card.drag-over {
    border: 2px dashed var(--primary);
    background-color: rgba(37, 99, 235, 0.05);
}

.card-grid {
    position: relative;
}

.card-grid.drag-active {
    min-height: 300px;
}

.drag-placeholder {
    border: 2px dashed var(--border);
    background-color: rgba(0, 0, 0, 0.02);
    border-radius: 0.5rem;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

[data-theme="dark"] .drag-placeholder {
    background-color: rgba(255, 255, 255, 0.02);
}

.drag-handle {
    position: absolute;
    top: 10px;
    right: 10px;
    opacity: 0;
    transition: opacity 0.2s ease;
    color: var(--text-light);
    cursor: grab;
    font-size: 0.9rem;
}

.stat-card:hover .drag-handle {
    opacity: 1;
}

.drag-handle:active {
    cursor: grabbing;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-light);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== RESPONSIVE SIDEBAR ===== */
@media (max-width: 991.98px) {
    .sidebar { 
        display: none !important; 
    }
    
    .main-content { 
        margin-left: 0 !important; 
        width: 100% !important; 
        padding: 1rem; 
        transition: none; 
    }
    
    .navbar-toggler { 
        display: none; 
    }
    
    .sidebar-backdrop { 
        display: none; 
    }
    
    .brand-logo-img { 
        height: 22px; 
        width: auto; 
        max-width: 100%;
        display: inline-block; 
        object-fit: contain;
    }
}

/* Desktop collapsible sidebar */
@media (min-width: 992px) {
    body.sidebar-collapsed .sidebar { 
        width: 72px; 
    }
    
    body.sidebar-collapsed .main-content { 
        margin-left: 72px; 
        width: calc(100% - 72px); 
    }
    
    body.sidebar-collapsed .sidebar-brand-text { 
        display: none; 
    }
    
    body.sidebar-collapsed .btn-sidebar { 
        justify-content: center; 
        padding: 0; 
        height: 44px; 
        width: 44px; 
        align-self: center;
        align-items: center;
        display: flex;
        overflow: visible;
    }
    
    body.sidebar-collapsed .btn-sidebar i { 
        margin-right: 0 !important; 
    }
    
    body.sidebar-collapsed .btn-sidebar span:not(.ticket-badge) { 
        display: none; 
    }
    
    body.sidebar-collapsed .btn-sidebar .ticket-badge { 
        display: block !important;
        position: absolute;
        top: 6px;
        right: 6px;
        width: 10px;
        height: 10px;
        padding: 0;
        min-width: 0;
        margin: 0;
        font-size: 0;
        line-height: 0;
        border-radius: 50%;
        border: 2px solid var(--bg-primary, #fff);
    }
    
    body.sidebar-collapsed .user-info { 
        justify-content: center; 
    }
    
    body.sidebar-collapsed .user-name, 
    body.sidebar-collapsed .user-role,
    body.sidebar-collapsed .user-company { 
        display: none !important; 
    }
    
    body.sidebar-collapsed .user-info > div { 
        display: none; 
    }
    
    #collapse-sidebar-btn { 
        height: 44px; 
        display: inline-flex; 
        align-items: center; 
        justify-content: center;
        width: 100%;
    }
    
    #collapse-sidebar-btn i {
        display: inline-block !important;
        margin-right: 0.5rem !important;
    }
    
    #collapse-sidebar-btn span {
        display: inline-block !important;
    }
    
    body.sidebar-collapsed #collapse-sidebar-btn { 
        height: 44px; 
        width: 100%;
        align-items: center;
        justify-content: center;
        display: flex;
    }
    
    body.sidebar-collapsed #collapse-sidebar-btn span { 
        display: none !important; 
    }
    
    body.sidebar-collapsed #collapse-sidebar-btn i { 
        display: inline-block !important;
        margin: 0 !important; 
        transform: rotate(180deg);
    }
}

/* ===== LOGIN PAGE STYLES ===== */
.login-container {
    width: 100%;
    max-width: 480px;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(-20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.login-card {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    text-align: center;
}

.login-header {
    padding: 40px 20px 20px;
    position: relative;
    overflow: hidden;
}

.logo-container {
    width: auto;
    max-width: 100%;
    height: auto;
    margin: 0 auto 20px;
    background: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    padding: 10px;
}

.logo-container[style*="background:none"] {
    background: none !important;
    box-shadow: none !important;
}

.logo-login {
    height: 80px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.login-title {
    font-weight: 700;
    font-size: 1.8rem;
    color: var(--text);
    margin-bottom: 5px;
    letter-spacing: -0.5px;
}

.login-subtitle {
    color: #64748b;
    font-size: 1rem;
    margin-bottom: 30px;
}

.login-body {
    padding: 0 30px 30px;
}

.form-control {
    width: 100%;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    font-size: 1rem;
    line-height: 1.5;
    transition: all 0.3s;
    background: var(--card-bg);
    color: var(--text);
    margin-bottom: 0px;
}

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

/* Readonly form controls in light theme */
.form-control[readonly] {
    background-color: #f1f5f9;
    color: #64748b;
    cursor: not-allowed;
    opacity: 0.8;
}

.form-control[readonly]:focus {
    border-color: var(--border);
    box-shadow: none;
}

.form-label {
    display: block;
    text-align: left;
    margin-bottom: 0px;
    font-weight: 500;
    color: var(--text);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.5px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25);
}

.btn-login:active {
    transform: translateY(0);
}

.footer {
    padding: 25px 0 15px;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: #64748b;
    text-align: center;
}

.form-group {
    margin-bottom: 25px;
    text-align: left;
}

.alert {
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 25px;
}

.input-group {
    position: relative;
}

.input-container {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1.1rem;
    z-index: 10;
}

.input-with-icon {
    padding-left: 45px;
}

/* ===== 2FA VERIFICATION PAGE STYLES ===== */
.verify-container {
    width: 100%;
    max-width: 400px;
    animation: fadeIn 0.5s ease;
}

.verify-card {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    text-align: center;
}

.verify-header {
    background: var(--primary);
    color: white;
    padding: 30px 20px;
    position: relative;
    overflow: hidden;
}

.verify-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
    transform: rotate(30deg);
}

.verify-icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
}

.verify-body {
    padding: 30px 25px;
}

.verify-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text);
}

.btn-verify {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-verify:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* ===== FORM STYLES ===== */
.form-text {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.form-select {
    width: 100%;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background-color: var(--card-bg);
    color: var(--text);
    font-size: 1rem;
    line-height: 1.5;
    transition: all 0.3s;
}

.form-select:focus {
    border-color: var(--primary);
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.25);
}

/* Bootstrap form overrides */
.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

[data-theme="dark"] .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e");
}

/* ===== FILTERS STYLES ===== */
.filters .form-control,
.filters .form-select {
    min-width: 120px;
}

/* Specific minimum widths for different filter fields */
.filters input[type="date"] {
    min-width: 140px;
}

.filters input[type="text"] {
    min-width: 150px;
}

.filters select {
    min-width: 120px;
}

/* ===== ALERT STYLES ===== */
.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #dc2626;
}

.alert-danger i {
    color: #dc2626;
}

/* ===== BUTTON STYLES ===== */
.btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.375rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    text-decoration: none;
}

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

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

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
    background-color: transparent;
}

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

.btn-outline-secondary {
    color: var(--secondary);
    border-color: var(--secondary);
    background-color: transparent;
}

.btn-outline-secondary:hover {
    color: #fff;
    background-color: var(--secondary);
    border-color: var(--secondary);
}

.btn-outline-danger {
    color: var(--danger);
    border-color: var(--danger);
    background-color: transparent;
}

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

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

.btn-success:hover {
    color: #fff;
    background-color: #059669;
    border-color: #047857;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.25rem;
}

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

/* ===== GRID UTILITIES ===== */
.d-grid {
    display: grid;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.gap-1 {
    gap: 0.25rem;
}

.gap-2 {
    gap: 0.5rem;
}

.d-flex {
    display: flex;
}

.justify-content-center {
    justify-content: center;
}

/* ===== TEXT UTILITIES ===== */
.text-muted {
    color: var(--text-light) !important;
}

.me-1 {
    margin-right: 0.25rem !important;
}

.me-2 {
    margin-right: 0.5rem !important;
}

/* ===== TOOLTIP STYLES ===== */
.tooltip-ctl {
    position: relative;
}

/* Большой tooltip с темным фоном и выносом */
.tooltip {
    font-size: 0.95rem;
    opacity: 1;
}

.tooltip .tooltip-inner {
    background-color: #212529;
    color: #fff;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    max-width: 300px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.tooltip.bs-tooltip-right .arrow::before {
    border-right-color: #212529;
}

.tooltip.bs-tooltip-left .arrow::before {
    border-left-color: #212529;
}

.tooltip.bs-tooltip-top .arrow::before {
    border-top-color: #212529;
}

.tooltip.bs-tooltip-bottom .arrow::before {
    border-bottom-color: #212529;
}

/* Убеждаемся, что tooltips отображаются с правильным z-index и не обрезаются */
.tooltip {
    z-index: 1070;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(-20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* ===== OFFCANVAS MENU ===== */
.offcanvas {
    background-color: var(--card-bg);
    border-color: var(--border);
}

.offcanvas-header {
    border-bottom: 1px solid var(--border);
    background-color: var(--card-bg);
}

.offcanvas-body {
    background-color: var(--card-bg);
    padding: 1rem;
}

.offcanvas-backdrop {
    background-color: rgba(0, 0, 0, 0.5);
}

/* List group in offcanvas */
.list-group-item {
    background-color: var(--card-bg);
    color: var(--text);
    border-color: var(--border);
}

.list-group-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .list-group-item:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

/* ===== LOGIN PAGE SPECIFIC BODY STYLES ===== */
body.login-page {
    background-color: var(--background);
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Login page specific form control styles */
body.login-page .form-control {
    border-radius: 10px !important;
    padding: 14px 20px;
    border: 1px solid var(--border);
    font-size: 1rem;
    transition: all 0.3s;
    background: var(--card-bg);
    color: var(--text);
}

body.login-page .input-with-icon {
    padding-left: 45px;
}

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

body.verify-page {
    background-color: var(--background);
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* ===== INLINE STYLES REPLACEMENTS ===== */
/* Progress bar styles */
.progress-bar-100 {
    width: 100%;
}

.progress-bar-processed {
    background: #3b82f6;
}

.progress-bar-success {
    background: #10b981;
}

.progress-bar-error {
    background: #ef4444;
}

.progress-bar-ignored {
    background: #64748b;
}

/* Text size utilities */
.text-size-09 {
    font-size: 0.9em;
}

.text-size-08 {
    font-size: 0.8em;
}

/* Preformatted blocks (CSP-safe) */
.pre-response-snippet {
    white-space: pre-wrap;
    max-height: 200px;
    overflow: auto;
    font-size: 0.875rem;
}

/* Toast container */
.toast-container-custom {
    z-index: 9999;
}

/* Logo styles */
.logo-height-20 {
    height: 20px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.logo-height-120 {
    height: 120px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.logo-container-login {
    background: none;
    box-shadow: none;
    width: 100%;
    max-width: 100%;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

/* Spacer divs */
.spacer-height-72 {
    height: 72px;
}

/* Custom dates visibility */
.custom-dates-hidden {
    display: none !important;
}

/* Bank suggestions */
.bank-suggestions {
    z-index: 1000;
    max-height: 240px;
    overflow-y: auto;
}

.bank-suggestions-hidden {
    display: none !important;
}

.sbp-bank-suggest {
    z-index: 9999;
    max-height: 240px;
    overflow: auto;
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* API token display */
.api-token-display {
    cursor: pointer;
}

/* Error message styles */
.error-message {
    background: red;
    color: white;
    padding: 20px;
    text-align: center;
}

.weekly-days-section.show,
.monthly-day-section.show {
    display: block;
}

.bank-error-message {
    padding: 10px 12px;
    color: #dc2626;
}

/* ===== ICON STYLES ===== */
/* SBP logo sizes */
.icon-sbp-size {
    width: 18px;
    height: 18px;
    vertical-align: middle;
}

.icon-sbp-size-24 {
    width: 18px;
    height: 18px;
    vertical-align: middle;
}

.icon-permissions {
    font-size: 1.2rem;
    color: #6c757d;
    vertical-align: middle;
}

/* Icon vertical alignment */
.icon-vertical-align {
    vertical-align: middle;
}

/* ===== SUCCESS TEXT COLOR ===== */
.text-success {
    color: var(--success) !important;
}

/* Ensure success color is visible in both themes */
[data-theme="dark"] .text-success {
    color: var(--success) !important;
}

/* ===== FONT AWESOME FALLBACKS ===== */
/* Enhanced fallback system for Font Awesome icons */
.fas, .far, .fab, .fal, .fad, .fass, .fasr, .fasl, .fast {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro", "FontAwesome", sans-serif;
    font-weight: 900;
    display: inline-block;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    line-height: 1;
}

/* Local Font Awesome detection and loading */
@font-face {
    font-family: "Font Awesome 6 Free";
    font-style: normal;
    font-weight: 900;
    font-display: swap;
    src: url("../fonts/fontawesome/webfonts/fa-solid-900.woff2") format("woff2"),
         url("../fonts/fontawesome/webfonts/fa-solid-900.ttf") format("truetype");
}

@font-face {
    font-family: "Font Awesome 6 Free";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/fontawesome/webfonts/fa-regular-400.woff2") format("woff2"),
         url("../fonts/fontawesome/webfonts/fa-regular-400.ttf") format("truetype");
}

@font-face {
    font-family: "Font Awesome 6 Brands";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/fontawesome/webfonts/fa-brands-400.woff2") format("woff2"),
         url("../fonts/fontawesome/webfonts/fa-brands-400.ttf") format("truetype");
}

/* Fallback symbols when Font Awesome fails to load completely */
.fa-fallback .fa-plus::before { content: "+"; font-family: monospace; font-weight: bold; }
.fa-fallback .fa-filter::before { content: "⚡"; }
.fa-fallback .fa-times::before { content: "✕"; font-family: monospace; }
.fa-fallback .fa-arrow-up::before { content: "↑"; }
.fa-fallback .fa-arrow-down::before { content: "↓"; }
.fa-fallback .fa-exclamation-triangle::before { content: "⚠"; }
.fa-fallback .fa-info-circle::before { content: "ℹ"; }
.fa-fallback .fa-bars::before { content: "☰"; }
.fa-fallback .fa-user::before { content: "👤"; }
.fa-fallback .fa-cog::before { content: "⚙"; }
.fa-fallback .fa-sign-out-alt::before { content: "⏻"; }
.fa-fallback .fa-file::before { content: "📄"; }
.fa-fallback .fa-chart-bar::before { content: "📊"; }
.fa-fallback .fa-credit-card::before { content: "💳"; }
.fa-fallback .fa-download::before { content: "⬇"; }
.fa-fallback .fa-upload::before { content: "⬆"; }
.fa-fallback .fa-search::before { content: "🔍"; }
.fa-fallback .fa-calendar::before { content: "📅"; }

/* Improved fallback for common icons with better Unicode alternatives */
.fa-fallback .fas::before, 
.fa-fallback .far::before,
.fa-fallback .fab::before {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-weight: normal;
    color: currentColor;
}

/* Specific fallbacks for navigation and UI elements */
.fa-fallback .fa-home::before { content: "🏠"; }
.fa-fallback .fa-dashboard::before { content: "📊"; }
.fa-fallback .fa-tachometer-alt::before { content: "📊"; }
.fa-fallback .fa-money-bill-wave::before { content: "💰"; }
.fa-fallback .fa-file-alt::before { content: "📄"; }
.fa-fallback .fa-cogs::before { content: "⚙"; }
.fa-fallback .fa-question-circle::before { content: "❓"; }
.fa-fallback .fa-check::before { content: "✓"; font-family: monospace; color: #28a745; }
.fa-fallback .fa-check-circle::before { content: "✅"; }
.fa-fallback .fa-times-circle::before { content: "❌"; }

/* ===== DASHBOARD SPECIFIC STYLES ===== */
/* Make date input fields identical to select fields on dashboard */
.dashboard-filters input[type="date"],
.dashboard-filters input[type="datetime-local"] {
    /* Match form-select styling exactly */
    height: calc(1.5em + 0.75rem + 2px);
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--text);
    background-color: var(--card-bg);
    background-image: none;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.dashboard-filters input[type="date"]:focus,
.dashboard-filters input[type="datetime-local"]:focus {
    border-color: var(--primary);
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.25);
}

/* Dark theme styles for dashboard date fields */
[data-theme="dark"] .dashboard-filters input[type="date"],
[data-theme="dark"] .dashboard-filters input[type="datetime-local"] {
    background-color: #0b1220;
    color: var(--text);
    border-color: var(--border);
}

[data-theme="dark"] .dashboard-filters input[type="date"]:focus,
[data-theme="dark"] .dashboard-filters input[type="datetime-local"]:focus {
    box-shadow: 0 0 0 0.25rem rgba(59,130,246,0.25);
}

/* Custom dates container styling */
.dashboard-filters .custom-dates {
    margin-top: 0.5rem;
}

.dashboard-filters .custom-dates .row.g-2 {
    gap: 0.5rem;
}

.dashboard-filters .custom-dates .col {
    flex: 1;
    padding: 0;
}

/* Medium screens: optimize custom period layout */
@media (min-width: 768px) and (max-width: 1678px) {
    /* Reduce overall spacing in filters */
    .dashboard-filters .row {
        gap: 0.75rem;
        margin: 0;
    }
    
    .dashboard-filters .col-md-3 {
        padding: 0;
        flex: 0 0 auto;
        width: auto;
    }
    
    /* Status field - compact width */
    .dashboard-filters .col-md-3:nth-child(1) {
        min-width: 140px;
        max-width: 160px;
    }
    
    /* Period field - compact width */
    .dashboard-filters .col-md-3:nth-child(2) {
        min-width: 160px;
        max-width: 180px;
        flex: 1;
    }
    
    /* Button container - fixed width */
    .dashboard-filters .col-md-3:nth-child(3) {
        min-width: 140px;
        max-width: 160px;
    }
    
    /* Custom dates styling */
    .dashboard-filters .custom-dates {
        margin-top: 0.375rem; /* Reduced from 0.5rem */
    }
    
    .dashboard-filters .custom-dates .row.g-2 {
        gap: 0.25rem;
        margin: 0;
    }
    
    .dashboard-filters .custom-dates .col {
        padding: 0;
        flex: 1;
    }
    
    /* Remove bottom margin from form elements */
    .dashboard-filters .mb-2 {
        margin-bottom: 0rem !important; /* Reduced from default */
    }
}

/* Ensure date inputs match the width and height of select fields */
.dashboard-filters .custom-dates input[type="date"] {
    width: 100%;
    min-width: 0; /* Allow flex shrinking */
}

/* Align apply button with the select field (not the custom dates) */
.dashboard-filters .col-md-3.d-flex.align-items-end {
    align-items: flex-end !important;
    padding-top: 0;
    margin-top: 0;
}

/* Adjust button container to align with form-select baseline */
.dashboard-filters .col-md-3.d-flex.align-items-end .btn {
    margin-bottom: 0;
}

/* Medium and large screens: fix apply button position at the level of period select field */
@media (min-width: 768px) {
    .dashboard-filters .col-md-3.d-flex.align-items-end {
        align-items: flex-start !important;
        padding-top: 1.5rem; /* 24px instead of 28px */
    }
    
    .dashboard-filters .col-md-3.d-flex.align-items-end .btn {
        margin-top: 0;
        margin-bottom: 0;
    }
}

/* ===== FAB (FLOATING ACTION BUTTON) STYLES ===== */
/* Use more specific selector to avoid conflict with Font Awesome .fab (brands) */
button.fab, .btn.fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    z-index: 1050;
    transition: all 0.3s ease;
}

button.fab:hover, .btn.fab:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

button.fab:active, .btn.fab:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

button.fab.fab-success, .btn.fab.fab-success {
    background-color: var(--success);
}

button.fab.fab-success:hover, .btn.fab.fab-success:hover {
    background-color: #059669;
}

/* Multiple FAB buttons positioning */
.fab-group {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1050;
}

.fab-group button.fab, .fab-group .btn.fab {
    position: relative;
    bottom: auto;
    right: auto;
    margin: 0;
}

/* ===== MOBILE BUTTON ADAPTATIONS ===== */
/* Hide text in buttons on mobile, show only icons */
@media (max-width: 991.98px) {
    /* Page header buttons - hide text, keep icons */
    .page-header .btn span:not(.sr-only) {
        display: none;
    }
    
    .page-header .btn {
        padding: 0.375rem 0.75rem;
        min-width: 44px;
        height: 38px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .page-header .btn i {
        margin-right: 0 !important;
        font-size: 1.1rem;
    }
    
    /* Reset card order button - icon only */
    #reset-card-order {
        padding: 0.375rem 0.75rem;
        min-width: 44px;
        height: 38px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    #reset-card-order span {
        display: none;
    }
    
    #reset-card-order i {
        margin-right: 0 !important;
        font-size: 1.1rem;
    }
    
    /* Ensure consistent spacing between all page header buttons */
    .page-header .d-flex {
        gap: 0.5rem;
    }
}

/* ===== FILTER BUTTON RESPONSIVE FIXES ===== */
/* Prevent text wrapping in filter buttons on narrow screens */
#apply-filters,
#apply-file-filters,
#apply-payout-filters {
    white-space: nowrap;
}

/* On very small screens, show only icon in apply buttons */
@media (max-width: 575.98px) {
    #apply-filters,
    #apply-file-filters,
    #apply-payout-filters {
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
        /* Hide text content after the icon */
        font-size: 0;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        min-width: auto;
        width: auto;
        flex: 0 0 auto;
    }
    
    #apply-filters .me-2,
    #apply-file-filters .me-2,
    #apply-payout-filters .me-2 {
        margin-right: 0 !important;
    }
    
    /* Show only the icon */
    #apply-filters i,
    #apply-file-filters i,
    #apply-payout-filters i {
        font-size: 1rem;
    }
    
    /* Optimize button container layout for all filter pages */
    .dashboard-filters .col-md-3.d-flex.align-items-end,
    .filters .col-md-3.d-flex.align-items-end,
    .filters .col-md-2.d-flex.align-items-end {
        flex: 0 0 auto;
        max-width: none;
        gap: 0.25rem;
    }
    
    /* Clear filters button - compact on very small screens */
    .dashboard-filters .btn-outline-secondary,
    .filters .btn-outline-secondary {
        padding: 0.375rem 0.5rem;
        min-width: auto;
    }
}

/* On small screens only (tablets in portrait), optimize spacing but keep full text */
@media (min-width: 576px) and (max-width: 767.98px) {
    /* Ensure button container doesn't take full width on mobile for all filter pages */
    .dashboard-filters .col-md-3.d-flex.align-items-end,
    .filters .col-md-3.d-flex.align-items-end,
    .filters .col-md-2.d-flex.align-items-end {
        flex: 0 0 auto;
        max-width: none;
    }
    
    .dashboard-filters .col-md-3.d-flex.align-items-end .btn,
    .filters .col-md-3.d-flex.align-items-end .btn,
    .filters .col-md-2.d-flex.align-items-end .btn {
        min-width: 0;
    }
    
    /* Clear filters button styling */
    .dashboard-filters .btn-outline-secondary,
    .filters .btn-outline-secondary {
        padding: 0.375rem 0.6rem;
        min-width: auto;
    }
}

/* ===== UPLOAD ERROR DETAILS STYLES ===== */
/* Make the "Show details" button more visible in light theme */
[data-theme="light"] .alert-danger [data-error-toggle].btn-outline-light {
    color: var(--primary);
    border-color: var(--primary);
    background-color: transparent;
    border-width: 1.5px;
    font-weight: 600;
}
[data-theme="light"] .alert-danger [data-error-toggle].btn-outline-light:hover,
[data-theme="light"] .alert-danger [data-error-toggle].btn-outline-light:focus {
    color: #fff;
    background-color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 0 0.15rem rgba(37,99,235,0.25);
}

/* Harmonize nested table in dark theme so it doesn't blend with background */
[data-theme="dark"] #upload-error-details .card.card-body.bg-light {
    background-color: #000000 !important;
    color: var(--text);
    border: 1px solid var(--border);
}
[data-theme="dark"] #upload-error-details table.table {
    color: var(--text);
}
[data-theme="dark"] #upload-error-details table.table th,
[data-theme="dark"] #upload-error-details table.table td {
    border-color: var(--border);
}
[data-theme="dark"] #upload-error-details .badge.bg-danger {
    background-color: #ef4444 !important;
    color: #fff;
}

/* Collapse behavior without inline styles (CSP-safe) */
.error-collapsed { display: none; }
.error-collapsed.show { display: block; }

/* Utility: fixed width column */
.col-fixed-120 { width: 120px; }

/* Body reset utilities for offcanvas/modal (CSP-safe) */
body.body-reset-overflow { overflow: auto !important; }

/* CSP-safe replacements for inline styles */
.col-width-40 { width: 40px; }
.btn-font-size-12em { font-size: 1.2em; }

/* CSP-safe display utilities */
.d-block { display: block !important; }
.d-none { display: none !important; }

/* CSP-safe bank suggestion item styles */
.bank-suggestion-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #e2e8f0;
}
body.body-reset-padding { padding-right: 0 !important; }