@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');

:root {
    --sidebar-width-expanded: 260px;
    --sidebar-width-collapsed: 80px;
    --sidebar-bg: #1a1a2e;
    --sidebar-hover: rgba(255,255,255,0.1);
    --sidebar-active: rgba(102, 126, 234, 0.2);
    --primary-color: #667eea;
    --transition-speed: 0.3s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
}

/* Основной wrapper приложения */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Левая боковая панель */
.sidebar {
    width: var(--sidebar-width-expanded);
    background: var(--sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: width var(--transition-speed) ease, transform var(--transition-speed) ease;
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-width-collapsed);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 70px;
    position: relative;
}

.sidebar.collapsed .sidebar-header {
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
}

.sidebar-header .logo {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-header .logo .logo-full {
    max-height: 70px;
    width: auto;
    max-width: 100%;
    display: block;
    transition: opacity var(--transition-speed) ease;
}

.sidebar-header .logo .logo-icon {
    max-height: 30px;
    width: auto;
    display: none;
    transition: opacity var(--transition-speed) ease;
}

.sidebar.collapsed .sidebar-header .logo .logo-full {
    display: none;
}

.sidebar.collapsed .sidebar-header .logo .logo-icon {
    display: block;
}


.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin: 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: #fff;
    text-decoration: none;
    transition: all var(--transition-speed) ease;
    border-left: 3px solid transparent;
    white-space: nowrap;
    position: relative;
}

.sidebar.collapsed .sidebar-nav a {
    justify-content: center;
    padding: 1rem 0;
    gap: 0;
}

.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    border-left-color: var(--primary-color);
}

.sidebar-nav a.active {
    background: var(--sidebar-active);
    border-left-color: var(--primary-color);
}

.sidebar-nav .nav-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav .nav-text {
    font-weight: 500;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.sidebar.collapsed .sidebar-nav .nav-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* Tooltip для collapsed режима */
.sidebar.collapsed .sidebar-nav a::after {
    content: attr(title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: var(--sidebar-bg);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    margin-left: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    z-index: 1001;
}

.sidebar.collapsed .sidebar-nav a:hover::after {
    opacity: 1;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    transition: padding var(--transition-speed) ease;
}

.sidebar.collapsed .sidebar-footer {
    padding: 1rem 0.5rem;
}

.user-info {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    overflow: hidden;
}

.sidebar.collapsed .user-info {
    flex-direction: column;
    gap: 0.5rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    text-transform: uppercase;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    min-width: 0;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.sidebar.collapsed .user-details {
    opacity: 0;
    width: 0;
    height: 0;
    overflow: hidden;
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.8rem;
    color: #aaa;
    margin-top: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #fff;
    text-decoration: none;
    padding: 0.75rem;
    background: rgba(255,255,255,0.1);
    border-radius: 5px;
    transition: all var(--transition-speed) ease;
    font-weight: 500;
}

.sidebar.collapsed .logout-btn {
    padding: 0.75rem 0.5rem;
}

.logout-btn:hover {
    background: rgba(255,255,255,0.2);
}

.logout-icon {
    flex-shrink: 0;
}

.logout-text {
    opacity: 1;
    transition: opacity 0.2s ease;
}

.sidebar.collapsed .logout-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* Основной контент */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width-expanded);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-speed) ease;
    overflow-x: hidden;
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-width-collapsed);
}

/* Мобильный header (скрыт на десктопе) */
.mobile-header {
    display: none;
    background: #1a1a2e;
    color: #fff;
    padding: 1rem;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.menu-toggle {
    background: none;
    border: none;
    width: 30px;
    height: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    padding: 0;
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.mobile-logo img {
    height: 40px;
}

.mobile-user-icon {
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar-mobile {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), #764ba2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    text-transform: uppercase;
}

main {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    width: 100%;
}

/* Адаптивность для планшетов и мобильных */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-header {
        display: flex;
    }
    
    main {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    main {
        padding: 1rem;
    }
    
    .sidebar {
        width: 280px;
    }
    
    /* Всегда показываем полный логотип на мобильных */
    .sidebar.collapsed .sidebar-header .logo .logo-full {
        display: block;
    }
    
    .sidebar.collapsed .sidebar-header .logo .logo-icon {
        display: none;
    }
    
    /* Всегда показываем текст на мобильных */
    .sidebar.collapsed .nav-text,
    .sidebar.collapsed .user-details,
    .sidebar.collapsed .logout-text {
        opacity: 1;
        width: auto;
        height: auto;
        overflow: visible;
    }
    
    /* Отключаем collapsed ширину на мобильных */
    .sidebar.collapsed {
        width: 280px;
    }
    
    .sidebar.collapsed .sidebar-header .logo {
        opacity: 1;
        width: auto;
        height: auto;
        overflow: visible;
    }
}

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 3rem;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.logo-container {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-container img {
    height: 70px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: #333;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

button {
    width: 100%;
    padding: 0.75rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
}

button:hover {
    background: #764ba2;
}

.dashboard h1 {
    margin-bottom: 2rem;
}

.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

@media (max-width: 576px) {
    .quick-stats {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.stat-card h3 {
    color: #666;
    margin-bottom: 1rem;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #667eea;
}

.stat-card small {
    color: #999;
    font-size: 0.875rem;
}

.financial-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.finance-card {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.finance-card.revenue {
    border-left: 5px solid #10b981;
}

.finance-card.expense {
    border-left: 5px solid #ef4444;
}

.finance-card.profit {
    border-left: 5px solid #667eea;
}

.finance-card.profit.negative {
    border-left-color: #ef4444;
}

.finance-value {
    font-size: 1.2rem;
    font-weight: bold;
    margin-top: 0.5rem;
}

.revenue .finance-value {
    color: #10b981;
}

.expense .finance-value {
    color: #ef4444;
}

.profit .finance-value {
    color: #667eea;
}

.profit.negative .finance-value {
    color: #ef4444;
}

.finance-card.deposits {
    border-left: 5px solid #f59e0b;
}

.deposits .finance-value {
    color: #f59e0b;
}

.finance-card small {
    display: block;
    margin-top: 0.5rem;
    color: #6b7280;
    font-size: 0.875rem;
}

.alerts-section {
    margin-top: 2rem;
}

.alert {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-left: 5px solid;
}

.alert h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.alert p {
    margin: 0;
    color: #374151;
}

.alert a {
    color: #667eea;
    font-weight: 600;
    text-decoration: none;
}

.alert a:hover {
    text-decoration: underline;
}

.alert-warning {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

.alert-danger {
    border-left-color: #ef4444;
    background: #fef2f2;
}

.quick-actions {
    margin-top: 3rem;
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.action-btn {
    display: block;
    text-align: center;
    padding: 1rem;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102,126,234,0.4);
}

.messages {
    margin-bottom: 2rem;
}

.message {
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.message.error {
    background: #fee;
    color: #c00;
    border: 1px solid #fcc;
}

.message.success {
    background: #efe;
    color: #080;
    border: 1px solid #cfc;
}

.change-password-container {
    background: white;
    padding: 3rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-width: 500px;
    margin: 0 auto;
}

.page-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h1 {
    font-size: 2rem;
    color: #333;
    margin: 0;
}

.form-container {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-width: 900px;
}

.form-container h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #667eea;
    color: #667eea;
}

.form-container h3:first-of-type {
    margin-top: 0;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.form-container .form-group {
    margin-bottom: 1.5rem;
}

.form-container .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-container .form-group input,
.form-container .form-group select,
.form-container .form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.form-container .form-group input:focus,
.form-container .form-group select:focus,
.form-container .form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.form-container .error {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-actions {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
    display: flex;
    gap: 1rem;
    justify-content: flex-start;
}

.btn {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102,126,234,0.4);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.calendar-header .btn-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
    width: 100px;
}

.calendar-header .btn-outline:hover {
    background: #667eea;
    color: white;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
    overflow-x: auto;
    padding-bottom: 1rem;
}

.kanban-column {
    background: #f9fafb;
    border-radius: 10px;
    min-width: 250px;
    display: flex;
    flex-direction: column;
}

.column-header {
    padding: 1rem;
    border-radius: 10px 10px 0 0;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.column-header.new {
    background: #6366f1;
}

.column-header.contacted {
    background: #8b5cf6;
}

.column-header.confirmed {
    background: #3b82f6;
}

.column-header.paid {
    background: #10b981;
}

.column-header.completed {
    background: #059669;
}

.column-header.rejected {
    background: #ef4444;
}

.column-header h3 {
    font-size: 1rem;
    margin: 0;
    font-weight: 600;
}

.column-header .count {
    background: rgba(255,255,255,0.3);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.kanban-cards {
    padding: 1rem;
    flex: 1;
    min-height: 200px;
}

.kanban-cards.drag-over {
    background: #e5e7eb;
}

.kanban-card {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    cursor: move;
    transition: all 0.2s ease;
}

.kanban-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.kanban-card.dragging {
    opacity: 0.5;
}

.kanban-card .card-header {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kanban-card .card-header strong {
    color: #111827;
    font-size: 1rem;
}

.kanban-edit-btn {
    opacity: 0.6;
    transition: opacity 0.2s;
    text-decoration: none;
    font-size: 14px;
    pointer-events: auto;
    cursor: pointer;
}

.kanban-edit-btn:hover {
    opacity: 1;
}

.kanban-card .card-body p {
    margin: 0.5rem 0;
    font-size: 0.875rem;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.kanban-card .icon {
    font-size: 1rem;
}

.kanban-card .source {
    color: #9ca3af;
    font-size: 0.75rem;
    margin-top: 0.75rem;
}

.kanban-card .card-footer {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f3f4f6;
    display: flex;
    justify-content: space-between;
}

.kanban-card .card-footer small {
    font-size: 0.75rem;
    color: #9ca3af;
}

.empty-message {
    text-align: center;
    color: #9ca3af;
    font-size: 0.875rem;
    margin-top: 2rem;
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}

.page-header h1 {
    font-size: 2rem;
    color: #111827;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

/* Filters bar */
.filters-bar {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.filters-form {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    font-size: 0.95rem;
}

.filter-select {
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
}

/* Tables */
.table-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
    color: #1f2937;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

.data-table .empty-state {
    text-align: center;
    padding: 3rem;
    color: #9ca3af;
    font-style: italic;
}

.table-footer {
    padding: 1rem 1.5rem;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    border-radius: 0 0 10px 10px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-stage-new {
    background: #dbeafe;
    color: #1e40af;
}

.badge-stage-contacted {
    background: #e9d5ff;
    color: #6b21a8;
}

.badge-stage-confirmed {
    background: #bfdbfe;
    color: #1e3a8a;
}

.badge-stage-paid {
    background: #d1fae5;
    color: #065f46;
}

.badge-stage-completed {
    background: #a7f3d0;
    color: #064e3b;
}

.badge-stage-rejected {
    background: #fee2e2;
    color: #991b1b;
}

.badge-website {
    background: #dbeafe;
    color: #1e40af;
}

.badge-telegram {
    background: #bfdbfe;
    color: #1e3a8a;
}

.badge-phone {
    background: #d1fae5;
    color: #065f46;
}

.badge-referral {
    background: #fef3c7;
    color: #92400e;
}

.badge-other {
    background: #e5e7eb;
    color: #374151;
}

/* Action buttons */
.actions-cell {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    font-size: 1.25rem;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s;
}

.btn-icon:hover {
    transform: scale(1.2);
}

.link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.link:hover {
    text-decoration: underline;
}

/* Detail pages */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.detail-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.detail-card.full-width {
    grid-column: 1 / -1;
}

.detail-card h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: #111827;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e5e7eb;
}

.detail-row {
    display: flex;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f3f4f6;
}

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

.detail-row .label {
    font-weight: 600;
    color: #6b7280;
    width: 180px;
    flex-shrink: 0;
}

.detail-row .value {
    color: #111827;
    flex: 1;
}

.detail-row .value a {
    color: #667eea;
    text-decoration: none;
}

.detail-row .value a:hover {
    text-decoration: underline;
}

/* Danger zone */
.action-panel {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.action-panel h2 {
    margin-bottom: 1.5rem;
    color: #333;
    font-size: 1.5rem;
}

.action-buttons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.btn-success, button.btn-success {
    background: #10b981;
    color: white;
    border: none;
    cursor: pointer;
}

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

.btn-primary, button.btn-primary {
    background: #3b82f6;
    color: white;
    border: none;
    cursor: pointer;
}

.btn-primary:hover, button.btn-primary:hover {
    background: #2563eb;
}

.btn-warning, button.btn-warning {
    background: #f59e0b;
    color: white;
    border: none;
    cursor: pointer;
}

.btn-warning:hover, button.btn-warning:hover {
    background: #d97706;
}

.danger-zone {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.danger-zone h3 {
    color: #991b1b;
    margin-bottom: 1rem;
}

/* Photo gallery */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.photo-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.photo-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.photo-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.photo-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.photo-delete-form {
    position: absolute;
    top: 10px;
    right: 10px;
}

.btn-delete-photo {
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-delete-photo:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Confirm delete */
.confirm-delete {
    max-width: 600px;
    margin: 0 auto;
}

.warning-box {
    background: #fef3c7;
    border: 2px solid #fbbf24;
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 2rem;
}

.warning-box h2 {
    color: #92400e;
    margin-bottom: 1rem;
}

.warning-box p {
    color: #78350f;
    margin: 0.5rem 0;
}

.small-text {
    font-size: 0.875rem;
    font-style: italic;
}

.detail-summary {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.detail-summary h3 {
    margin-bottom: 1rem;
    color: #111827;
}

.detail-summary ul {
    list-style: none;
    padding: 0;
}

.detail-summary li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f3f4f6;
}

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

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

@media (max-width: 992px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1rem;
    border-left: 4px solid #667eea;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-card.stat-primary {
    border-left-color: #10b981;
}

.stat-card.stat-danger {
    border-left-color: #ef4444;
}

.stat-card.stat-success {
    border-left-color: #10b981;
}

.stat-card.stat-warning {
    border-left-color: #f59e0b;
}

.stat-card.stat-info {
    border-left-color: #3b82f6;
}

.stat-card.stat-secondary {
    border-left-color: #6b7280;
}

.stat-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
    line-height: 1;
    width: 2.5rem;
    text-align: center;
}

.stat-content {
    flex: 1 1 calc(100% - 4rem);
    min-width: 120px;
}

.stat-content h3 {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
    margin-top: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.4;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    width: 100%;
}

.stat-value small {
    display: block;
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 400;
    margin-top: 0.5rem;
    line-height: 1.4;
}

@media (max-width: 576px) {
    .stat-card {
        padding: 1.25rem;
    }
    
    .stat-icon {
        font-size: 2rem;
        width: 2rem;
    }
    
    .stat-content {
        flex: 1 1 100%;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

.chart-card h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: #111827;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e5e7eb;
}

.chart-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chart-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.chart-label {
    min-width: 150px;
    font-weight: 500;
}

.chart-value {
    min-width: 60px;
    text-align: right;
    font-weight: 600;
    color: #111827;
}

.chart-bar {
    height: 30px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 5px;
    transition: width 0.3s ease;
}

.export-section {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-align: center;
}

.export-section h2 {
    margin-bottom: 1rem;
    color: #111827;
}

/* Settings */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.settings-card {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.settings-card h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: #111827;
}

.settings-card p {
    color: #6b7280;
    margin-bottom: 1rem;
}

.info-block {
    background: #f9fafb;
    padding: 1rem;
    border-radius: 5px;
    margin: 1rem 0;
}

.info-block p {
    margin: 0.5rem 0;
}

.info-block ul {
    margin: 0;
    padding-left: 1.5rem;
}

.info-block li {
    margin: 0.5rem 0;
    color: #374151;
}

/* Vehicle thumbnails */
.vehicle-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.vehicle-thumb-placeholder {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    font-size: 24px;
}

/* Responsive */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .filters-form {
        flex-direction: column;
    }
    
    .search-input,
    .filter-select {
        width: 100%;
    }
    
    /* Улучшенный скролл таблиц на мобильных */
    .table-container {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
    }
    
    .data-table {
        font-size: 0.875rem;
        min-width: 680px;
    }
    
    .data-table th {
        white-space: nowrap;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .detail-row {
        flex-direction: column;
    }
    
    .detail-row .label {
        width: 100%;
        margin-bottom: 0.25rem;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
}
.stat-subtitle { font-size: 0.875rem; color: #6b7280; margin-top: 4px; }

/* Submenu styles */
.has-submenu > a {
    position: relative;
}

.submenu-arrow {
    margin-left: auto;
    font-size: 0.75rem;
    transition: transform var(--transition-speed) ease;
}

.sidebar.collapsed .submenu-arrow {
    display: none;
}

.submenu {
    list-style: none;
    padding-left: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-speed) ease;
}

.submenu.show {
    max-height: 200px;
}

.submenu li {
    margin: 0;
}

.submenu a {
    padding: 0.75rem 1.5rem 0.75rem 3.5rem !important;
    font-size: 0.9rem;
    border-left: 3px solid transparent !important;
}

.submenu a:hover {
    background: var(--sidebar-hover);
}

.submenu a.active {
    background: var(--sidebar-active);
    border-left-color: var(--primary-color) !important;
}

.sidebar.collapsed .submenu {
    display: none;
}

/* Checkbox Group for License Categories */
.checkbox-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
}

/* Specific styling for Django MultipleChoiceField checkboxes */
.checkbox-group ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.checkbox-group ul li {
    margin: 0;
    position: relative;
}

/* Hide the default checkbox */
.checkbox-group ul li input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    width: 0;
    height: 0;
}

/* Create custom checkbox button */
.checkbox-group ul li label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    padding: 12px 20px;
    border: 2px solid #d1d5db;
    border-radius: 10px;
    background: #ffffff;
    transition: all 0.25s ease;
    font-weight: 600;
    font-size: 15px;
    min-width: 70px;
    position: relative;
    user-select: none;
    color: #6b7280;
}

/* Hover state for unchecked */
.checkbox-group ul li label:hover {
    border-color: #667eea;
    background: #f3f4f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.15);
}

/* Checked state - blue button with white checkmark */
.checkbox-group ul li input[type="checkbox"]:checked ~ label {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

/* Add checkmark icon before text when checked */
.checkbox-group ul li input[type="checkbox"]:checked ~ label::before {
    content: "✓";
    font-size: 16px;
    font-weight: bold;
    margin-right: 4px;
    animation: checkmarkPop 0.3s ease;
}

/* Checkmark animation */
@keyframes checkmarkPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Active/clicking state */
.checkbox-group ul li label:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

/* Focus state for accessibility */
.checkbox-group ul li input[type="checkbox"]:focus ~ label {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}
