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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.hidden {
    display: none !important;
}

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

.login-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.login-card form {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.login-card .form-group {
    margin-bottom: 20px;
}

.login-card .btn-primary {
    width: 100%;
    margin-top: 10px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.login-card h1 {
    margin-bottom: 30px;
    text-align: center;
    color: var(--text-primary);
    font-size: 28px;
}

.login-switch {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.login-switch a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.login-switch a:hover {
    text-decoration: underline;
}

.login-hint {
    margin-top: 20px;
    padding: 15px;
    background-color: var(--bg-color);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.login-hint p {
    margin: 5px 0;
}

.error-message {
    background-color: #fee2e2;
    color: #dc2626;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
    border: 1px solid #fecaca;
}

.error-message.hidden {
    display: none;
}

/* Header */
.header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    overflow-x: hidden;
    /* Для iOS - не створюємо новий stacking context, який може обмежити меню */
    isolation: auto;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(12px, 2vw, 20px);
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: clamp(10px, 1.5vw, 15px);
    width: 100%;
    box-sizing: border-box;
}

.header-left {
    display: flex;
    align-items: center;
    gap: clamp(10px, 1.5vw, 15px);
    flex: 0 1 auto;
    min-width: 0;
    flex-shrink: 1;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: clamp(20px, 2.5vw, 24px);
    cursor: pointer;
    padding: 0;
    color: var(--text-primary);
    border-radius: 4px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(36px, 4vw, 40px);
    height: clamp(36px, 4vw, 40px);
    line-height: 1;
    flex-shrink: 0;
}

.menu-toggle:hover {
    background-color: var(--bg-color);
}

.header h1 {
    font-size: clamp(18px, 3vw, 24px);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    line-height: 1.2;
    display: flex;
    align-items: center;
    flex-shrink: 1;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1.5vw, 15px);
    flex-shrink: 0;
    position: relative;
    z-index: 100;
    flex-wrap: nowrap;
    justify-content: flex-end;
    line-height: 1;
    /* Для iOS - не створюємо новий stacking context */
    isolation: auto;
}

.search-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    font-size: clamp(18px, 2.5vw, 20px);
    width: clamp(36px, 4vw, 40px);
    height: clamp(36px, 4vw, 40px);
    line-height: 1;
    flex-shrink: 0;
}

.search-toggle:hover {
    background-color: var(--bg-color);
    color: var(--primary-color);
    transform: scale(1.1);
}

.search-toggle:active {
    transform: scale(0.95);
}

.search-icon {
    font-size: clamp(18px, 2.5vw, 20px);
    line-height: 1;
    display: block;
}

.search-dropdown {
    position: fixed;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    padding: 10px;
    min-width: 300px;
    z-index: 10000;
    animation: slideDown 0.2s ease-out;
}

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

.search-dropdown.hidden {
    display: none;
}

.search-dropdown input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.search-dropdown input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

@media (max-width: 768px) {
    .search-dropdown {
        min-width: calc(100vw - 40px);
        max-width: 400px;
    }
}

.user-info {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

/* Меню користувача */
.user-profile-menu {
    position: relative;
    cursor: pointer;
    touch-action: manipulation; /* Видаляє 300ms затримку на iOS */
    -webkit-tap-highlight-color: transparent; /* Прибирає підсвітку при торканні на iOS */
    user-select: none; /* Запобігає виділенню тексту при торканні */
}

.user-profile-icon {
    width: clamp(36px, 4vw, 40px);
    height: clamp(36px, 4vw, 40px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(18px, 2.5vw, 20px);
    color: white;
    transition: transform 0.2s;
    flex-shrink: 0;
    line-height: 1;
    padding: 0;
    overflow: hidden;
    touch-action: manipulation; /* Видаляє 300ms затримку на iOS */
    -webkit-tap-highlight-color: transparent; /* Прибирає підсвітку при торканні на iOS */
    user-select: none; /* Запобігає виділенню тексту при торканні */
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-profile-icon:hover {
    transform: scale(1.1);
}

.user-menu-dropdown {
    position: fixed;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    max-width: 350px;
    z-index: 99999;
    display: none;
    overflow: hidden;
    /* Для iOS - створюємо новий stacking context */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
}

.user-menu-dropdown.open {
    display: block;
    /* Додаткові стилі для iOS */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    isolation: isolate;
}

/* Media Queries for Header Responsiveness */
@media (max-width: 1024px) {
    .header-content {
        padding: clamp(12px, 1.5vw, 18px);
    }
    
    .header-left {
        gap: clamp(8px, 1.2vw, 12px);
    }
    
    .header-actions {
        gap: clamp(6px, 1.2vw, 12px);
    }
}

@media (max-width: 768px) {
    .header-content {
        gap: clamp(8px, 1.5vw, 12px);
        padding: clamp(10px, 1.5vw, 15px);
    }
    
    .header-left {
        gap: clamp(8px, 1.2vw, 12px);
        flex-shrink: 1;
    }
    
    .header-actions {
        gap: clamp(6px, 1.2vw, 10px);
        flex-shrink: 0;
    }
    
    .header h1 {
        font-size: clamp(16px, 4vw, 20px);
    }
    
    .user-menu-dropdown {
        min-width: 260px;
        max-width: calc(100vw - 20px);
    }
    
    .user-profile-menu {
        position: relative;
    }
}

@media (max-width: 480px) {
    .header-content {
        padding: clamp(10px, 2.5vw, 15px);
        gap: clamp(8px, 2vw, 12px);
    }
    
    .header-left {
        gap: clamp(6px, 1.5vw, 10px);
        flex: 1 1 100%;
        order: 1;
    }
    
    .header-actions {
        flex: 1 1 100%;
        justify-content: flex-end;
        width: 100%;
        gap: clamp(6px, 1.5vw, 10px);
        order: 2;
    }
    
    .header h1 {
        font-size: clamp(14px, 5vw, 18px);
        max-width: calc(100% - clamp(32px, 5vw, 40px) - clamp(6px, 1.5vw, 10px));
    }
    
    .search-dropdown {
        min-width: calc(100vw - 20px);
        max-width: calc(100vw - 20px);
    }
}

.user-menu-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
}

.user-menu-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.user-menu-role {
    font-size: 12px;
    color: var(--text-secondary);
}

.user-menu-timers {
    padding: 12px 16px;
    max-height: 300px;
    overflow-y: auto;
}

.user-menu-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.user-menu-timers-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-menu-timer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-color);
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
    transition: background-color 0.2s;
}

.user-menu-timer-item:hover {
    background: #f3f4f6;
}

.timer-item-info {
    flex: 1;
    min-width: 0;
}

.timer-item-order {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 2px;
}

.timer-item-desc {
    font-size: 12px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timer-item-time {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: 600;
    color: #10b981;
    margin-left: 8px;
    white-space: nowrap;
}

.user-menu-empty {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 13px;
}

.user-menu-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid var(--border-color);
}

.user-menu-item:hover {
    background-color: var(--bg-color);
}

.user-menu-item:active {
    background-color: #e5e7eb;
}

.server-menu-toggle {
    justify-content: space-between;
}

.server-menu-arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
    user-select: none;
    display: inline-block;
}

.server-submenu {
    background-color: var(--bg-color);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.server-submenu.hidden {
    max-height: 0;
}

.server-submenu:not(.hidden) {
    max-height: 300px;
}

.server-submenu-item {
    padding-left: 48px;
    font-size: 14px;
    background-color: var(--bg-color);
}

.settings-icon {
    font-size: 18px;
}

.user-menu-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-color);
}

.user-menu-logout {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.2s;
}

.user-menu-logout:hover {
    background: #f3f4f6;
    color: var(--danger-color);
}

.logout-icon {
    font-size: 18px;
    transition: transform 0.2s;
    display: inline-block;
}

.user-menu-logout:hover .logout-icon {
    transform: translateX(4px);
}

.timer-item-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Стилі для зайнятості механіків в меню аккаунта */
.user-menu-mechanics {
    padding: 12px 16px;
    max-height: 300px;
    overflow-y: auto;
}

.user-menu-mechanics-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user-menu-mechanic-item {
    background: var(--bg-color);
    border-radius: 6px;
    padding: 10px;
    border-left: 3px solid var(--secondary-color);
    transition: all 0.2s;
}

.user-menu-mechanic-item.mechanic-busy {
    cursor: pointer;
}

.user-menu-mechanic-item.mechanic-busy:hover {
    background: #fee2e2;
    transform: translateX(2px);
}

.user-menu-mechanic-item.mechanic-busy {
    border-left-color: var(--danger-color);
    background: #fef2f2;
}

.user-menu-mechanic-item.mechanic-free {
    border-left-color: var(--success-color);
    background: #f0fdf4;
}

.user-menu-mechanic-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.user-menu-mechanic-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.user-menu-mechanic-status.status-busy {
    background-color: var(--danger-color);
}

.user-menu-mechanic-status.status-free {
    background-color: var(--success-color);
}

.user-menu-mechanic-name {
    font-size: 13px;
    font-weight: 600;
    flex: 1;
}

.user-menu-mechanic-status-text {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.user-menu-mechanic-timers {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.user-menu-mechanic-timer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.user-menu-mechanic-timer-item:hover {
    background: #f9fafb;
}

.user-menu-mechanic-timer-info {
    flex: 1;
    min-width: 0;
}

.user-menu-mechanic-timer-company {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 2px;
}

.user-menu-mechanic-timer-desc {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu-mechanic-timer-time {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--danger-color);
    margin-left: 8px;
    white-space: nowrap;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 11px;
    min-width: auto;
}

/* Mechanics Page */
.mechanics-page {
    padding: 20px;
}

.mechanics-page h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 24px;
}

/* Debtors Page */
.debtors-page {
    padding: 20px;
}

.debtors-page h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 24px;
}

.purchases-page {
    padding: 20px;
}

.purchases-page h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 24px;
}

@media (max-width: 480px) {
    .debtors-page,
    .purchases-page,
    .worktime-page {
        padding: 15px 10px;
    }
    
    .debtors-page h2,
    .purchases-page h2 {
        font-size: 20px;
        margin-bottom: 15px;
    }
    
    .worktime-container {
        padding: 20px 15px !important;
    }
    
    .worktime-nfc-section,
    .worktime-weekly-section,
    .worktime-calendar-section {
        margin-bottom: 25px;
        padding-bottom: 25px;
    }
    
    .worktime-nfc-section h3,
    .worktime-weekly-section h3,
    .worktime-calendar-section h3,
    .worktime-nfc-header h3 {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    #workTimeMechanicSelector {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    #workTimeMechanicSelector label {
        font-size: 14px;
    }
    
    #workTimeMechanicSelect {
        width: 100%;
        min-width: 100%;
    }
    
    /* Weekly stats section */
    .worktime-weekly-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .worktime-week-display {
        order: 0;
        text-align: center;
        padding: 8px;
        background: var(--bg-color);
        border-radius: 6px;
        font-size: 13px;
    }
    
    .worktime-weekly-controls {
        flex-direction: column;
        gap: 8px;
    }
    
    .worktime-weekly-controls button {
        flex: 1;
        width: 100%;
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .worktime-total-hours {
        font-size: 20px;
    }
    
    .worktime-weekly-stats {
        padding: 15px;
    }
    
    #workTimeDailyBreakdown {
        font-size: 12px;
    }
    
    #workTimeDailyBreakdown th,
    #workTimeDailyBreakdown td {
        padding: 6px 4px;
    }
    
    /* NFC section */
    .worktime-nfc-info {
        padding: 12px !important;
        font-size: 14px;
    }
    
    .nfc-tag-status {
        font-size: 14px !important;
    }
    
    /* Calendar */
    .worktime-calendar-wrapper {
        padding: 5px !important;
    }
    
    .fc-header-toolbar {
        font-size: 12px;
    }
    
    .fc-button {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .fc-toolbar-title {
        font-size: 14px;
    }
    
    .fc-col-header-cell-cushion,
    .fc-daygrid-day-number {
        font-size: 12px;
    }
    
    .fc-event-title {
        font-size: 11px;
    }
}

.debtors-list {
    display: grid;
    gap: 15px;
}

.mechanics-list {
    display: grid;
    gap: 20px;
}

.mechanic-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--success-color);
    transition: all 0.2s;
}

.mechanic-card.mechanic-busy {
    border-left-color: var(--danger-color);
    background: #fef2f2;
}

.mechanic-card-header {
    margin-bottom: 15px;
}

.mechanic-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.mechanic-status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mechanic-status-indicator.status-free {
    background-color: var(--success-color);
}

.mechanic-status-indicator.status-busy {
    background-color: var(--danger-color);
}

.mechanic-details {
    flex: 1;
}

.mechanic-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.mechanic-status-text {
    font-size: 11px;
    color: var(--text-secondary);
}

.mechanic-timers {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mechanic-timer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border-color);
}

.mechanic-timer-item:hover {
    background: #f3f4f6;
    border-color: var(--primary-color);
    transform: translateX(4px);
}

.mechanic-no-timers {
    padding: 15px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    font-style: italic;
}

.mechanic-timer-info {
    flex: 1;
    min-width: 0;
}

.mechanic-timer-company {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 2px;
}

.mechanic-timer-desc {
    font-size: 11px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mechanic-timer-time {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--danger-color);
    margin-left: 8px;
    white-space: nowrap;
}


/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

@media (max-width: 768px) {
    .main-content {
        padding: 20px 15px;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 15px 10px;
    }
}

.toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.total-profit {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--success-color);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.total-profit.hidden {
    display: none;
}

.profit-icon {
    font-size: 20px;
    font-weight: 700;
}

.profit-amount {
    font-family: 'Courier New', monospace;
    font-size: 18px;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-add-order {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.btn-add-order:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.btn-add-order:active {
    transform: scale(0.95);
}

.btn-add-order.hidden {
    display: none;
}

.btn-add-icon {
    font-size: 32px;
    font-weight: 300;
    line-height: 1;
}

.btn-icon-improve-notes {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary-color);
    transition: color 0.2s;
}
.btn-icon-improve-notes:hover:not(:disabled) {
    color: var(--primary-color);
}
.btn-icon-improve-notes:disabled {
    cursor: not-allowed;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

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

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

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

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    min-width: 100px;
    justify-content: center;
}

/* Orders List */
.orders-list {
    display: grid;
    gap: 8px;
}

.order-card-wrapper {
    position: relative;
    margin-bottom: 8px;
    width: 100%;
    overflow: hidden; /* Обмежуємо вихід за межі */
}

/* На мобільних додаткові обмеження */
@media (max-width: 768px) {
    .order-card-wrapper {
        overflow: hidden;
        max-width: 100vw;
    }
}

.order-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease-out;
    position: relative;
    z-index: 1;
    touch-action: pan-y;
    width: 100%;
    box-sizing: border-box;
    min-width: 0; /* Дозволяє картці зменшуватися */
}

@media (max-width: 768px) {
    .order-card {
        will-change: transform; /* Оптимізація для анімації */
    }
}

.order-card:hover {
    box-shadow: var(--shadow-lg);
}

@media (hover: hover) {
    .order-card:hover {
        transform: translateY(-2px);
    }
}

/* Підсвічування нових закінчених замовлень без інвойсу */
.order-card.new-completed-highlight {
    background: linear-gradient(90deg, #fef3c7 0%, #fde68a 50%, #fef3c7 100%);
    background-size: 200% 100%;
    animation: highlight-shine 3s ease-in-out infinite;
    border: 2px solid #f59e0b;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* Підсвічування нових замовлень */
.order-card.new-order-highlight {
    background: linear-gradient(90deg, #dbeafe 0%, #bfdbfe 50%, #dbeafe 100%);
    background-size: 200% 100%;
    animation: highlight-shine 3s ease-in-out infinite;
    border: 2px solid #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

@keyframes highlight-shine {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.order-header {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    padding: 4px 0;
    min-width: 0;
    width: 100%;
}

@media (max-width: 768px) {
    .order-header {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        gap: 8px;
    }
    
    .order-title {
        grid-column: 1 / -1;
        font-size: 14px;
        gap: 6px;
        flex-wrap: wrap;
        align-items: flex-start;
    }
    
    .order-company-name {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        min-width: 0;
        flex: 1 1 100%;
    }
    
    .order-header-meta {
        display: block;
        margin-top: 2px;
        margin-left: 0;
    }
    
    .order-actions-icons {
        grid-column: 1;
        grid-row: 2;
        justify-self: flex-start;
    }
    
    .order-status {
        grid-column: 2;
        grid-row: 2;
        justify-self: flex-end;
        font-size: 11px;
        padding: 4px 10px;
    }
}

@media (max-width: 480px) {
    .order-header {
        gap: 6px;
        padding: 8px 0;
    }
    
    .order-title {
        font-size: 14px;
        gap: 6px;
        flex-wrap: wrap;
        align-items: flex-start;
    }
    
    .order-company-name {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
    
    .order-header-meta {
        display: block;
        margin-top: 2px;
    }
    
    .order-number-badge {
        font-size: 11px;
        padding: 3px 8px;
        min-width: 45px;
    }
    
    .order-status {
        font-size: 11px;
        padding: 4px 10px;
    }
    
    .order-actions-icons {
        gap: 2px;
    }
}

.order-header:hover {
    opacity: 0.8;
}

.toggle-icon {
    display: inline-block;
    margin-right: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.order-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    overflow: hidden;
}

.order-number-badge {
    background-color: var(--primary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    min-width: 50px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
}

.editor-initial {
    font-size: 11px;
    font-weight: bold;
    margin-left: 4px;
    padding: 2px 5px;
    border-radius: 3px;
    background-color: #ef4444;
    color: white !important;
    display: inline-block;
    min-width: 16px;
    text-align: center;
}

.order-company-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.order-header-meta {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9em;
}

.order-actions-icons {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    justify-content: flex-end;
}

@media (max-width: 480px) {
    .order-actions-icons {
        gap: 2px;
    }
}

.order-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    transition: opacity 0.3s ease;
    flex-shrink: 0;
    white-space: nowrap;
}

.order-status.status-blinking {
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

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

.status-in_progress {
    background-color: #fef3c7;
    color: #92400e;
}

.status-completed {
    background-color: #d1fae5;
    color: #065f46;
}

.status-paid {
    background-color: #dcfce7;
    color: #166534;
}

.status-debtors {
    background-color: #fef3c7;
    color: #92400e;
}

.btn-warning {
    background-color: #f59e0b;
    color: white;
}

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

/* Згорнуті поля при редагуванні */
.collapsed-fields-container {
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-color);
}

.collapsed-fields-header {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-primary);
    user-select: none;
    transition: background-color 0.2s;
}

.collapsed-fields-header:hover {
    background-color: var(--card-bg);
}

.collapsed-icon {
    font-size: 12px;
    color: var(--primary-color);
    transition: transform 0.2s;
}

.collapsed-fields-content {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

/* Таймер для робіт */
.work-item-display {
    transition: background-color 0.2s;
}

.work-item-display:hover {
    background-color: var(--bg-color);
}

.work-timer-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.work-timer-display {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: 600;
    padding: 4px 8px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    min-width: 70px;
    text-align: center;
}

.work-timer-controls .btn-sm {
    padding: 4px 8px;
    font-size: 12px;
    min-width: 32px;
}

.order-details {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 2000px;
    }
}

.order-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
    margin-top: 12px;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.info-label-edit-icon {
    cursor: pointer;
    opacity: 1;
    transition: color 0.2s;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    padding: 2px;
}

.info-label-edit-icon:hover {
    color: var(--primary-color);
}

.info-value-editing {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
}

.info-value-input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--card-bg);
}

.info-value-textarea {
    min-height: 60px;
    resize: none;
    overflow-y: hidden;
    word-wrap: break-word;
    white-space: pre-wrap;
    line-height: 1.5;
}

.info-value-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    align-items: flex-start;
    padding-top: 2px;
}

.info-value-btn {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.info-value-btn-save {
    background-color: var(--primary-color);
    color: white;
}

.info-value-btn-save:hover {
    background-color: var(--primary-color-dark);
}

.info-value-btn-cancel {
    background-color: var(--border-color);
    color: var(--text-primary);
}

.info-value-btn-cancel:hover {
    background-color: var(--text-secondary);
}

.info-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    max-width: 100%;
}

.order-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.status-control {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: var(--shadow-lg);
    margin: auto;
    position: relative;
    box-sizing: border-box;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--card-bg);
    z-index: 10;
}

.modal-header h2 {
    font-size: 20px;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.modal-close:hover {
    background-color: var(--bg-color);
}

.modal form {
    padding: 20px;
}

.modal-body {
    padding: 20px;
    box-sizing: border-box;
    overflow-x: hidden;
    width: 100%;
}

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

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

@media (max-width: 480px) {
    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px; /* Запобігає збільшенню на iOS */
    }
}

.work-item {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: flex-start;
}

.work-item input {
    flex: 1;
}

.work-item-remove {
    padding: 10px;
    background-color: var(--danger-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
}

.part-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 10px;
    align-items: start;
}

.part-item input {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.part-item input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

@media (max-width: 768px) {
    .part-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* Status Selector */
.status-control {
    display: flex;
    gap: 8px;
    align-items: center;
}

.status-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    min-width: 150px;
}

.status-select:hover {
    border-color: var(--primary-color);
}

.status-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state h3 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

/* Navigation Menu */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    transition: opacity 0.3s ease-out;
}

.menu-overlay.hidden {
    display: none;
}

.navigation-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: var(--card-bg);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transform: translateX(0);
    transition: transform 0.3s ease-out;
    overflow-y: auto;
}

.navigation-menu.hidden {
    transform: translateX(-100%);
}

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

.nav-close {
    background: none;
    border: none;
    font-size: 28px;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.nav-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-list li {
    border-bottom: 1px solid var(--border-color);
}

.nav-link {
    display: block;
    padding: 16px 20px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
    min-height: 50px;
    line-height: 18px;
    box-sizing: border-box;
}

.nav-link-admin {
    display: block;
    padding: 16px 20px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
    min-height: 50px;
    line-height: 18px;
    box-sizing: border-box;
}

.nav-link:hover,
.nav-link-admin:hover {
    background-color: var(--bg-color);
    color: var(--primary-color);
}

.nav-link.active,
.nav-link-admin.active {
    background-color: var(--primary-color);
    color: white;
}

.nav-link.active:hover,
.nav-link-admin.active:hover {
    background-color: var(--primary-hover);
}

.nav-link {
    position: relative;
}

.new-orders-badge {
    position: absolute;
    top: 10px;
    right: 15px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border-radius: 12px;
    min-width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    padding: 0 6px;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4), 0 1px 2px rgba(0, 0, 0, 0.1);
    line-height: 1;
    border: 2px solid white;
    animation: pulse 2s ease-in-out infinite;
    transition: all 0.3s ease;
}

.new-orders-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(239, 68, 68, 0.5), 0 2px 4px rgba(0, 0, 0, 0.15);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.9;
        transform: scale(1.05);
    }
}

.nav-link.active .new-orders-badge {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.35) 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 6px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.1);
}

.nav-link.active .new-orders-badge:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0.45) 100%);
}

.completed-orders-badge {
    position: absolute;
    top: 10px;
    right: 15px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border-radius: 12px;
    min-width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    padding: 0 6px;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4), 0 1px 2px rgba(0, 0, 0, 0.1);
    line-height: 1;
    border: 2px solid white;
    animation: pulse 2s ease-in-out infinite;
    transition: all 0.3s ease;
}

.completed-orders-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(245, 158, 11, 0.5), 0 2px 4px rgba(0, 0, 0, 0.15);
}

.nav-link.active .completed-orders-badge {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.35) 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 6px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.1);
}

.nav-link.active .completed-orders-badge:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0.45) 100%);
}

.nav-link-add {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.2);
    color: white !important;
    font-weight: 300;
    padding: 0;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-decoration: none;
}

.nav-link-add:hover {
    background-color: rgba(255, 255, 255, 0.3) !important;
    color: white !important;
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.nav-link-add:active {
    transform: scale(0.95);
}

.nav-icon {
    font-size: 16px;
    font-weight: 300;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.nav-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 8px 0;
    border: none;
}

/* Кнопка ключа для покупок */
.purchase-key-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.2s;
    flex-shrink: 0;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.purchase-key-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.purchase-key-btn:active {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Кнопки для фото */
.photo-camera-btn,
.photo-folder-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.2s;
    flex-shrink: 0;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-camera-btn:hover,
.photo-folder-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.photo-camera-btn:active,
.photo-folder-btn:active {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Стилі для списку фото */
.photos-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

@media (max-width: 768px) {
    .photos-list {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
        padding: 15px 0;
    }
}

@media (max-width: 480px) {
    .photos-list {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

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

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

.photo-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    cursor: pointer;
    display: block;
}

.photo-info {
    padding: 12px;
}

.photo-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}

.photo-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.photo-uploader {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Повноекранне відображення фото */
.photo-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.photo-fullscreen-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.photo-fullscreen-prev,
.photo-fullscreen-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10;
    flex-shrink: 0;
}

.photo-fullscreen-prev:hover,
.photo-fullscreen-next:hover {
    background: rgba(255, 255, 255, 0.35);
}

.photo-fullscreen-prev {
    left: 16px;
}

.photo-fullscreen-next {
    right: 16px;
}

.photo-fullscreen-counter {
    position: absolute;
    bottom: -36px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    white-space: nowrap;
}

.photo-fullscreen-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 32px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    z-index: 10;
}

.photo-fullscreen-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
    .photo-fullscreen-close {
        top: 10px;
        right: 10px;
        width: 48px;
        height: 48px;
        font-size: 36px;
    }
    .photo-fullscreen-prev,
    .photo-fullscreen-next {
        width: 44px;
        height: 44px;
        font-size: 28px;
    }
    .photo-fullscreen-prev {
        left: 8px;
    }
    .photo-fullscreen-next {
        right: 8px;
    }
}

.photo-fullscreen-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

/* Purchase Modal Styles */
.purchase-item {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    align-items: center;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
}

.purchase-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.purchase-item:last-child {
    margin-bottom: 0;
}

.purchase-name {
    flex: 1 1 auto;
    min-width: 0;
    padding: 10px 12px !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    background: white;
    box-sizing: border-box;
    width: 100%;
}

.purchase-name:focus {
    outline: none;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.purchase-remove {
    padding: 8px 16px !important;
    font-size: 13px !important;
    min-width: auto !important;
    white-space: nowrap;
    flex-shrink: 0;
    box-sizing: border-box;
}

#purchasesItems {
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    box-sizing: border-box;
    width: 100%;
}

#purchasesItems::-webkit-scrollbar {
    width: 6px;
}

#purchasesItems::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 3px;
}

#purchasesItems::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

#purchasesItems::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

#addPurchaseItem {
    width: 100%;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

/* Responsive */
@media (max-width: 768px) {
    .purchase-item {
        gap: 8px;
        padding: 10px;
    }
    
    .purchase-name {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 8px 10px !important;
    }
    
    .purchase-remove {
        padding: 8px 12px !important;
        font-size: 12px !important;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }


    .form-row {
        grid-template-columns: 1fr;
    }

    .order-info {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .navigation-menu {
        width: 100%;
    }
    
    .order-card-wrapper {
        overflow: hidden;
        position: relative;
    }
    
    
    .modal {
        padding: 10px;
        align-items: flex-start;
        padding-top: 20px;
    }
    
    .modal-content {
        max-width: 100%;
        max-height: calc(100vh - 40px);
        margin: 0;
        border-radius: 12px 12px 0 0;
    }
    
    #invoiceModal .modal-content.invoice-modal-content {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    #invoiceModal.modal {
        padding: 0;
        align-items: stretch;
    }
    
    .modal-header {
        padding: 15px;
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    .modal-header h2 {
        font-size: 18px;
    }
    
    .modal form {
        padding: 15px;
    }
    
    .modal-actions {
        padding: 15px;
        flex-direction: column;
        gap: 10px;
    }
    
    .modal-actions .btn {
        width: 100%;
        padding: 12px;
        font-size: 16px;
    }
    
    /* Покращення для кнопок на мобільних */
    .btn {
        min-height: 44px; /* Мінімальний розмір для тач-інтерфейсу */
        padding: 12px 20px;
    }
    
    .btn-sm {
        min-height: 40px;
        padding: 10px 16px;
    }
    
    /* Іконки на мобільних */
    .photo-camera-btn,
    .photo-folder-btn,
    .purchase-key-btn {
        font-size: 22px;
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 15px 10px;
    }
    
    .toolbar {
        gap: 10px;
    }
    
    .order-card {
        padding: 10px 12px;
    }
    
    .order-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .order-actions .btn {
        width: 100%;
    }
    
    .status-control {
        width: 100%;
        flex-direction: column;
    }
    
    .status-select {
        width: 100%;
    }
    
    .modal-content {
        max-height: calc(100vh - 20px);
    }
    
    .modal-body {
        padding: 15px;
        overflow-x: hidden;
    }
    
    .purchase-item {
        gap: 8px;
        padding: 10px;
    }
    
    .purchase-name {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 8px 10px !important;
    }
    
    .purchase-remove {
        padding: 6px 10px !important;
        font-size: 12px !important;
    }
    
    .photo-image {
        height: 150px;
    }
    
    .pagination-simple {
        padding: 15px 10px;
    }
    
    .pagination-page-info {
        font-size: 12px;
        padding: 0 10px;
    }
    
    /* Сторінки боржників та покупок */
    .debtors-page,
    .purchases-page,
    .shop-purchases-page {
        padding: 15px 10px;
    }
    
    .debtors-page h2,
    .purchases-page h2,
    .shop-purchases-page h2 {
        font-size: 20px;
        margin-bottom: 15px;
    }
    
    /* Механіки */
    .mechanic-card {
        padding: 12px;
    }
    
    .mechanic-name {
        font-size: 16px;
    }
    
    /* Інформація про замовлення */
    .order-info {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .info-item {
        padding: 8px 0;
    }
    
    .info-label {
        font-size: 12px;
    }
    
    .info-value {
        font-size: 13px;
    }
    
    
    /* Покращення для пошуку */
    .search-dropdown input {
        font-size: 16px; /* Запобігає збільшенню на iOS */
    }
}

/* Account Settings Page */
.account-settings-page {
    padding: 20px;
    max-width: 900px;
    margin: 0 auto;
}

.settings-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow);
}

.settings-container h2 {
    margin: 0 0 40px 0;
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 600;
    text-align: center;
}

.settings-section {
    margin-bottom: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--border-color);
}

.settings-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.settings-section h3 {
    margin: 0 0 24px 0;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
    text-align: center;
}

.avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    width: 100%;
}

.avatar-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.avatar-preview-img {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background-color: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 4px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.avatar-preview-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-fallback {
    font-size: 70px;
    color: var(--text-secondary);
}

.avatar-upload {
    display: flex;
    flex-direction: row;
    gap: 12px;
    width: 100%;
    max-width: 500px;
    justify-content: center;
    align-items: center;
}

.avatar-upload .btn {
    flex: 1;
    min-width: 150px;
    max-width: 200px;
    justify-content: center;
    text-align: center;
}

.settings-form .form-group {
    margin-bottom: 24px;
    width: 100%;
}

.settings-form .form-group:last-child {
    margin-bottom: 0;
}

.settings-form .form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 15px;
    text-align: left;
}

.settings-form .form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: white;
    color: var(--text-primary);
    box-sizing: border-box;
    transition: all 0.2s ease;
}

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

.settings-form .form-control[readonly] {
    background-color: var(--bg-color);
    cursor: not-allowed;
    opacity: 0.7;
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: left;
}

.settings-actions {
    display: flex;
    gap: 16px;
    margin-top: 40px;
    justify-content: center;
    flex-wrap: wrap;
}

.settings-actions .btn {
    flex: 1;
    min-width: 150px;
    max-width: 250px;
    padding: 12px 24px;
    justify-content: center;
    text-align: center;
}

.success-message {
    background-color: #d1fae5;
    color: #065f46;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
    border: 1px solid #a7f3d0;
}

.success-message.hidden {
    display: none;
}

/* Сторінка медіафайлів */
.media-files-page {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.media-files-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.media-files-container h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 600;
}

.media-files-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.media-file-item {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.2s;
    position: relative;
}

.media-file-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.media-file-checkbox {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
}

.media-file-check {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.media-file-preview {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.media-file-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.media-file-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-file-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.media-file-type {
    font-weight: 500;
}

.media-file-separator {
    color: var(--text-secondary);
}

.media-file-details {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-file-date {
    color: var(--text-secondary);
}

.media-file-user {
    color: var(--text-secondary);
}

.pagination {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.pagination-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    min-width: 40px;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-ellipsis {
    padding: 8px 4px;
    color: var(--text-secondary);
}

.pagination-info {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
}

/* Work Time Page */
.worktime-page {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.worktime-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow);
}

/* Worktime mechanic selector */
#workTimeMechanicSelector {
    display: flex;
    gap: 10px;
    align-items: center;
}

#workTimeMechanicSelect {
    min-width: 200px;
}

/* Worktime weekly section */
.worktime-weekly-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.worktime-weekly-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.worktime-week-display {
    font-weight: bold;
    white-space: nowrap;
}

.worktime-weekly-stats {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.worktime-total-hours {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 15px;
}

.worktime-container h2 {
    margin: 0 0 30px 0;
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 600;
}

.worktime-nfc-section {
    margin-bottom: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--border-color);
}

.worktime-nfc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    cursor: pointer;
}

.worktime-nfc-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
}

.nfc-toggle-icon {
    font-size: 18px;
    user-select: none;
    transition: transform 0.2s;
}

.worktime-nfc-info {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.nfc-tag-status {
    font-size: 16px;
    margin-bottom: 10px;
}

.worktime-nfc-section h3 {
    margin: 0 0 20px 0;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
}

.worktime-weekly-section {
    margin-bottom: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--border-color);
}

.worktime-weekly-section h3 {
    margin: 0 0 20px 0;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
}

.worktime-calendar-section {
    margin-bottom: 20px;
}

.worktime-calendar-section h3 {
    margin: 0 0 20px 0;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
}

.worktime-calendar-wrapper {
    background: white;
    padding: 20px;
    border-radius: 8px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 14px;
}

#workTimeDailyBreakdown {
    margin-top: 15px;
}

#workTimeDailyBreakdown th,
#workTimeDailyBreakdown td {
    padding: 10px;
    text-align: left;
}

#workTimeDailyBreakdown th {
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

/* Kiosk Page Styles */
.kiosk-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg-color);
}

.kiosk-content {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 100%;
}

.kiosk-content h1 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-primary);
    font-size: 32px;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.success-message {
    background: #d1fae5;
    color: #065f46;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #6ee7b7;
}

@media (max-width: 768px) {
    .account-settings-page,
    .media-files-page,
    .worktime-page {
        padding: 15px;
    }
    
    .settings-container,
    .media-files-container,
    .worktime-container {
        padding: 24px;
    }
    
    .worktime-nfc-section,
    .worktime-weekly-section {
        margin-bottom: 30px;
        padding-bottom: 30px;
    }
    
    .worktime-nfc-section h3,
    .worktime-weekly-section h3,
    .worktime-calendar-section h3 {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    #workTimeDailyBreakdown {
        font-size: 14px;
    }
    
    #workTimeDailyBreakdown th,
    #workTimeDailyBreakdown td {
        padding: 8px;
    }
    
    /* Worktime mechanic selector on mobile */
    #workTimeMechanicSelector {
        width: 100%;
        justify-content: space-between;
    }
    
    #workTimeMechanicSelect {
        flex: 1;
        min-width: 150px;
    }
    
    /* Worktime weekly section buttons */
    .worktime-weekly-section > div:first-child {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .worktime-weekly-section button {
        flex: 1 1 auto;
        min-width: 80px;
    }
    
    #workTimeWeekDisplay {
        width: 100%;
        text-align: center;
        order: -1;
    }
    
    /* Worktime weekly header */
    .worktime-weekly-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .worktime-weekly-controls {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .worktime-week-display {
        width: 100%;
        text-align: center;
        order: -1;
        padding: 8px;
        background: var(--bg-color);
        border-radius: 6px;
    }
    
    .worktime-weekly-controls button {
        flex: 1 1 auto;
        min-width: 80px;
    }
    
    .worktime-total-hours {
        font-size: 20px;
    }
    
    /* Worktime calendar */
    .worktime-calendar-wrapper {
        padding: 10px !important;
    }
    
    #workTimeCalendar {
        padding: 0 !important;
    }
    
    .fc-toolbar {
        flex-wrap: wrap;
    }
    
    .fc-toolbar-chunk {
        margin: 5px 0;
    }
    
    /* Worktime NFC section */
    #nfcTagInfo {
        padding: 15px !important;
    }
    
    .worktime-nfc-header h3 {
        font-size: 18px;
    }
    
    .media-files-list {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .media-files-container h2 {
        font-size: 24px;
    }
    
    .settings-container h2 {
        font-size: 24px;
        margin-bottom: 32px;
    }
    
    .settings-section {
        margin-bottom: 32px;
        padding-bottom: 32px;
    }
    
    .settings-section h3 {
        font-size: 18px;
        margin-bottom: 20px;
    }
    
    .avatar-section {
        align-items: center;
    }
    
    .settings-section > div[style*="grid"] {
        grid-template-columns: 1fr !important;
    }
    
    .avatar-upload {
        flex-direction: column;
        max-width: 100%;
    }
    
    .avatar-upload .btn {
        width: 100%;
        max-width: 100%;
    }
    
    .settings-actions {
        flex-direction: column;
        margin-top: 32px;
    }
    
    .settings-actions .btn {
        width: 100%;
        max-width: 100%;
    }
}

/* Сторінка управління користувачами */
.users-management-page {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.users-management-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow-md);
}

.users-management-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.user-management-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

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

.user-management-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.user-management-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    flex-shrink: 0;
    overflow: hidden;
}

.user-management-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-management-info {
    flex: 1;
    min-width: 0;
}

.user-management-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.user-management-username {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.user-management-role {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 500;
}

.user-management-details {
    margin-bottom: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.user-management-detail {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.user-management-detail span {
    font-size: 16px;
}

.user-management-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.user-management-actions .btn {
    flex: 1;
    min-width: 100px;
}

@media (max-width: 768px) {
    .users-management-list {
        grid-template-columns: 1fr;
    }
    
    .users-management-container {
        padding: 20px;
    }
}

/* Kiosk Devices Admin Page */
.kiosk-devices-page {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.kiosk-devices-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow-md);
}

.kiosk-devices-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.kiosk-device-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

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

.kiosk-device-header {
    margin-bottom: 15px;
}

.kiosk-device-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kiosk-device-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.kiosk-device-status {
    font-size: 14px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 12px;
    display: inline-block;
    width: fit-content;
}

.status-active {
    background: #d1fae5;
    color: #065f46;
}

.status-inactive {
    background: #fee2e2;
    color: #991b1b;
}

.kiosk-device-details {
    margin-bottom: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.kiosk-device-detail {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.kiosk-device-detail span {
    font-size: 16px;
}

.device-token-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.token-masked {
    font-family: monospace;
    font-size: 12px;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    text-decoration: underline;
    font-size: 12px;
    padding: 0;
}

.btn-link:hover {
    color: var(--primary-color-dark);
}

.kiosk-device-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.kiosk-device-actions .btn {
    flex: 1;
    min-width: 100px;
}

/* NFC Tags Admin Page */
.nfc-tags-page {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.nfc-tags-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow-md);
}

.nfc-tags-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.nfc-tag-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

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

.nfc-tag-header {
    margin-bottom: 15px;
}

.nfc-tag-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nfc-tag-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.nfc-tag-status {
    font-size: 14px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 12px;
    display: inline-block;
    width: fit-content;
}

.nfc-tag-details {
    margin-bottom: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.nfc-tag-detail {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.nfc-tag-detail span {
    font-size: 16px;
}

.nfc-tag-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.nfc-tag-actions .btn {
    flex: 1;
    min-width: 100px;
}

@media (max-width: 768px) {
    .kiosk-devices-list,
    .nfc-tags-list {
        grid-template-columns: 1fr;
    }
    
    .kiosk-devices-container,
    .nfc-tags-container {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .settings-container {
        padding: 20px;
    }
    
    .settings-container h2 {
        font-size: 22px;
        margin-bottom: 24px;
    }
    
    .settings-section {
        margin-bottom: 24px;
        padding-bottom: 24px;
    }
    
    .avatar-preview-img {
        width: 120px;
        height: 120px;
    }
    
    .avatar-fallback {
        font-size: 60px;
    }
    
    .settings-form .form-group {
        margin-bottom: 20px;
    }
}

/* Social Settings Page */
.social-settings-page {
    padding: 20px;
    max-width: 900px;
    margin: 0 auto;
}

.social-settings-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow);
}


.social-settings-section {
    margin-bottom: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--border-color);
}

.social-settings-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* SMS Broadcast Page */
.sms-broadcast-page {
    padding: 20px;
    max-width: 900px;
    margin: 0 auto;
}

.sms-broadcast-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow);
}

.sms-recipients-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.sms-recipient-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 14px;
}

.sms-recipient-text {
    white-space: nowrap;
}

.sms-recipient-remove {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 2px 4px;
}

.sms-recipient-remove:hover {
    color: var(--text-primary);
}

.sms-recipients-box {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px;
    background: #fff;
}

.sms-recipient-input-row {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    align-items: center;
}

.sms-recipient-input-row .form-control {
    flex: 1;
}

.social-settings-section h3 {
    margin: 0 0 24px 0;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
}

.settings-form .form-group {
    margin-bottom: 20px;
}

.settings-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
}

.settings-form .form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.settings-form .form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.settings-form .form-text {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.settings-form .form-text a {
    color: var(--primary-color);
    text-decoration: none;
}

.settings-form .form-text a:hover {
    text-decoration: underline;
}

.settings-form .btn {
    margin-right: 10px;
    margin-top: 10px;
}

@media (max-width: 768px) {
    .social-settings-page {
        padding: 15px;
    }
    
    .social-settings-container {
        padding: 24px;
    }
    
    .social-settings-section {
        margin-bottom: 32px;
        padding-bottom: 32px;
    }
    
    .social-settings-section h3 {
        font-size: 18px;
        margin-bottom: 20px;
    }

    .sms-broadcast-page {
        padding: 15px;
    }
    
    .sms-broadcast-container {
        padding: 24px;
    }
}

@media (max-width: 480px) {
    .social-settings-container {
        padding: 20px 15px;
    }
    
    .settings-form .btn {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
    }

    .sms-broadcast-container {
        padding: 20px 15px;
    }
}

/* Invoice Modal - Layout as per design */
.invoice-modal-content {
    width: 85%;
    max-width: 85vw;
}

.invoice-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.invoice-note-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.invoice-note-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #374151;
}

.invoice-order-notes {
    width: 100%;
    min-height: 80px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

.invoice-order-notes:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.invoice-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.invoice-section-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
}

.invoice-section-icon {
    width: 20px;
    height: 20px;
    color: #6b7280;
}

.invoice-hourly-rate-row {
    display: flex;
    align-items: center;
    gap: 10px;
    align-self: flex-end;
}

.invoice-hourly-rate-row label {
    font-size: 14px;
    color: #374151;
}

.invoice-hourly-rate-input-wrap {
    display: flex;
    align-items: center;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    overflow: hidden;
}

.invoice-currency-prefix {
    padding: 8px 10px;
    background: #f9fafb;
    color: #6b7280;
    font-size: 14px;
}

.invoice-hourly-rate-input-wrap input {
    width: 100px;
    padding: 8px 12px;
    border: none;
    font-size: 14px;
}

.invoice-info-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    background: none;
    border: none;
    color: #6b7280;
    font-size: 14px;
    cursor: help;
    border-radius: 50%;
}

.invoice-info-btn:hover {
    color: var(--primary-color);
}

.invoice-items-container {
    display: flex;
    flex-direction: column;
}

.invoice-add-link {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 0;
    align-self: flex-start;
}

.invoice-add-link:hover {
    text-decoration: underline;
    color: #2563eb;
}

.invoice-remove-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.invoice-remove-icon:hover {
    color: #ef4444;
    background: #fef2f2;
}

.invoice-footer {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 8px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.invoice-footer-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
}

.invoice-summary {
    min-width: 160px;
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.invoice-summary-row {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    font-size: 14px;
    color: #374151;
}

.invoice-summary-row + .invoice-summary-row {
    margin-top: 6px;
}

.invoice-summary-total {
    font-weight: 700;
    font-size: 15px;
    color: #111827;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
}

/* Invoice Editor Styles */
.invoice-item,
.invoice-part {
    padding: 10px;
    background-color: var(--bg-color);
    border-radius: 8px;
    margin-bottom: 10px;
}

.invoice-item input,
.invoice-part input {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.invoice-item input:focus,
.invoice-part input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* Drag and Drop Styles for Invoice Items */
.invoice-item.dragging {
    opacity: 0.4;
    cursor: grabbing !important;
    transform: scale(0.98);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Placeholder для показу місця вставки */
.drag-placeholder {
    height: 4px;
    background: linear-gradient(90deg, transparent, #3b82f6, transparent);
    margin: 8px 0;
    border-radius: 2px;
    position: relative;
    animation: placeholder-pulse 1.5s ease-in-out infinite;
    pointer-events: none;
}

.drag-placeholder::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: #3b82f6;
    transform: translateY(-50%);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
}

@keyframes placeholder-pulse {
    0%, 100% {
        opacity: 1;
        transform: scaleY(1);
    }
    50% {
        opacity: 0.7;
        transform: scaleY(1.2);
    }
}

.invoice-item .drag-handle {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

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

.invoice-item:hover .drag-handle {
    color: var(--primary-color) !important;
}

.invoice-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Стилі для порожнього контейнера при перетягуванні не потрібні, 
   бо тепер використовується placeholder */

/* Invoice Icon Buttons */
.invoice-icon-btn {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    vertical-align: middle;
}

.invoice-icon-btn:hover {
    background-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

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

.invoice-icon-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Pagination */
.pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
    padding: 20px;
}

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

.pagination-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-ellipsis {
    padding: 0 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.pagination-simple {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
    padding: 20px;
}

.pagination-page-info {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    padding: 0 15px;
}

@media (max-width: 768px) {
    .pagination {
        padding: 15px 10px;
    }
    
    .pagination-controls {
        gap: 5px;
        flex-wrap: wrap;
    }
    
    .pagination-controls .btn-sm {
        min-width: 80px;
        padding: 8px 12px;
        font-size: 12px;
        min-height: 40px;
    }
    
    .pagination-info {
        font-size: 12px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .pagination-controls {
        gap: 4px;
    }
    
    .pagination-controls .btn-sm {
        min-width: 70px;
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .pagination-page-info {
        font-size: 11px;
        padding: 0 8px;
    }
}

/* Work item completed state */
.work-item-completed {
    opacity: 0.7;
    background: #f0f9ff;
}

.work-item-completed > div > div:first-child {
    text-decoration: line-through;
}

.work-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin-top: 2px;
    flex-shrink: 0;
}

.work-item-number {
    font-weight: 700;
    color: var(--primary-color);
    min-width: 20px;
}

.work-item-content {
    flex: 1;
}

.work-item-desc {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.work-item-hours,
.work-item-price {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 3px;
}

/* Сторінка покупок в шап */
.shop-purchases-page {
    padding: 20px;
}

.shop-purchases-page h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 24px;
}

.shop-purchases-list {
    margin-top: 20px;
}

.shop-purchase-item {
    transition: transform 0.2s, box-shadow 0.2s;
}

.shop-purchase-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

/* Profit Statistics Page */
.profit-statistics-page {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.profit-statistics-container {
    background: var(--bg-color);
    border-radius: 12px;
    padding: 30px;
}

.profit-stats-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.profit-stat-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 15px;
    background: #f9fafb;
    border-radius: 6px;
}

.profit-stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.profit-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--success-color);
    font-family: 'Courier New', monospace;
}

.profit-stat-value.negative {
    color: var(--danger-color);
}

.total-profit:hover {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

/* Profit Chart Timeframe Navigation */
.profit-chart-timeframe-nav {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.timeframe-btn {
    background: none;
    border: none;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.timeframe-btn:hover {
    color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.05);
    border-radius: 4px;
}

.timeframe-btn.active {
    color: var(--primary-color);
    font-weight: 600;
    position: relative;
}

.timeframe-btn.active::after {
    content: '';
    position: absolute;
    bottom: -11px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--primary-color);
}

.timeframe-separator {
    color: var(--border-color);
    margin: 0 4px;
    font-size: 12px;
}

/* Printer Page Styles */
.printer-page {
    padding: 20px;
    max-width: 900px;
    margin: 0 auto;
}

.printer-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow);
}

.printer-icon {
    font-size: clamp(18px, 2.5vw, 20px);
    line-height: 1;
    display: block;
}

@media (max-width: 768px) {
    .printer-container {
        padding: 24px;
    }
}

/* Warehouse Page Styles */
.warehouse-page {
    padding: 20px;
    max-width: 1600px;
    margin: 0 auto;
}

.warehouse-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.warehouse-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.warehouse-header-left h2 {
    margin: 0;
    font-size: 24px;
    color: var(--text-primary);
}

.warehouse-header-right {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.warehouse-search {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    min-width: 250px;
    max-width: 400px;
}

.warehouse-search:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Summary Cards */
.warehouse-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.warehouse-card {
    background: var(--card-bg);
    border-radius: 6px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow);
    border-left: 3px solid;
}

.warehouse-card-warning {
    border-left-color: var(--warning-color);
}

.warehouse-card-danger {
    border-left-color: var(--danger-color);
}

.warehouse-card-success {
    border-left-color: var(--success-color);
}

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

.warehouse-card-icon {
    font-size: 20px;
}

.warehouse-card-content {
    flex: 1;
}

.warehouse-card-title {
    font-size: 10px;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.warehouse-card-value {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-primary);
}

/* Warehouse Section */
.warehouse-section {
    margin-bottom: 30px;
}

.warehouse-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.warehouse-section-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
}

.warehouse-view-all {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
}

.warehouse-view-all:hover {
    text-decoration: underline;
}

/* Warehouse Table */
.warehouse-table-container {
    background: var(--card-bg);
    border-radius: 8px;
    overflow-x: auto;
    box-shadow: var(--shadow);
}

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

.warehouse-table thead {
    background: var(--bg-color);
}

.warehouse-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}

.warehouse-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.warehouse-table tbody tr:hover {
    background: var(--bg-color);
}

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

.warehouse-table .btn-sm {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.warehouse-table .btn-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.warehouse-table .btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.warehouse-table .btn-danger {
    background-color: var(--danger-color);
    color: white;
}

/* Status indicators */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
}

.status-dot.low {
    background-color: var(--warning-color);
}

.status-dot.out {
    background-color: var(--danger-color);
}

.status-dot.ok {
    background-color: var(--success-color);
}

/* Warehouse Tabs */
.warehouse-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.warehouse-tab {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.warehouse-tab:hover {
    color: var(--primary-color);
}

.warehouse-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.warehouse-tab-content {
    display: none;
}

.warehouse-tab-content.active {
    display: block;
}

#warehouseCatalogTab {
    display: block;
}

#warehouseCatalogTab.hidden {
    display: none;
}

/* Warehouse Footer */
.warehouse-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.warehouse-footer-right {
    display: flex;
    gap: 10px;
}

/* Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--card-bg);
    min-width: 160px;
    box-shadow: var(--shadow-lg);
    z-index: 1;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 5px;
    right: 0;
}

.dropdown-content a {
    color: var(--text-primary);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 14px;
}

.dropdown-content a:hover {
    background-color: var(--bg-color);
}

.dropdown-content.hidden {
    display: none;
}

.dropdown-content:not(.hidden) {
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    .warehouse-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .warehouse-header-right {
        width: 100%;
        flex-direction: column;
    }

    .warehouse-search {
        width: 100%;
        max-width: 100%;
    }

    .warehouse-summary-cards {
        grid-template-columns: 1fr;
    }

    .warehouse-table-container {
        overflow-x: scroll;
    }

    .warehouse-footer {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .warehouse-footer-right {
        flex-direction: column;
        width: 100%;
    }
}

/* ========== AI CHAT STYLES ========== */

.ai-chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    font-size: 28px;
    display: none; /* Прихований за замовчуванням, показується після логіну */
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    z-index: 9998;
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.6);
}

.ai-chat-toggle.active {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.ai-chat-panel {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 520px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    animation: aiChatSlideUp 0.3s ease-out;
}

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

.ai-chat-panel.hidden {
    display: none;
}

.ai-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 16px;
}

.ai-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.ai-chat-close:hover {
    opacity: 1;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9fa;
}

.ai-message {
    max-width: 90%;
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 14px;
    word-wrap: break-word;
}

.ai-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-message.bot {
    align-self: flex-start;
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ai-message.bot.loading {
    color: #888;
    font-style: italic;
}

.ai-message.bot.error {
    background: #fee2e2;
    color: #dc2626;
}

.ai-message code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
}

.ai-message strong {
    font-weight: 600;
}

.ai-chat-input-area {
    display: flex;
    padding: 12px 15px;
    background: white;
    border-top: 1px solid #eee;
    gap: 10px;
}

.ai-chat-input-area input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 24px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.2s;
}

.ai-chat-input-area input:focus {
    border-color: #667eea;
}

.ai-chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.ai-chat-send-btn:hover {
    transform: scale(1.05);
}

.ai-chat-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Typing indicator animation */
.ai-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px;
}

.ai-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #888;
    border-radius: 50%;
    animation: aiTyping 1.4s infinite ease-in-out;
}

.ai-typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

.ai-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes aiTyping {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .ai-chat-panel {
        width: calc(100% - 20px);
        height: calc(100vh - 140px);
        right: 10px;
        bottom: 80px;
        max-height: 500px;
    }
    
    .ai-chat-toggle {
        bottom: 15px;
        right: 15px;
        width: 55px;
        height: 55px;
        font-size: 24px;
    }
    
}

