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

html, body {
    overflow-x: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f6f9;
    color: #333;
    line-height: 1.6;
}

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

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 10px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.login-box h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 10px;
}

.login-box > p {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

.sidebar {
    width: 250px;
    background: #2c3e50;
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 5000;
}

.sidebar-header {
    padding: 20px 20px 20px 20px;
    background: #1a252f;
    border-bottom: 1px solid #34495e;
    overflow: hidden;
    position: relative;
}

.sidebar-header h2 {
    font-size: 18px;
    margin-bottom: 5px;
    word-break: break-word;
    white-space: normal;
}

.sidebar-header p {
    font-size: 12px;
    color: #95a5a6;
    word-break: break-word;
    white-space: normal;
}

.sidebar-menu {
    padding: 20px 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #ecf0f1;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.3s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: #34495e;
    border-left-color: #3498db;
}

.sidebar-menu i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.main-content {
    margin-left: 250px;
    flex: 1;
    padding: 20px;
    width: calc(100% - 250px);
    max-width: calc(100% - 250px);
    box-sizing: border-box;
    overflow-x: hidden;
    padding-top: 90px;
}

.header {
    background: white;
    padding: 15px 30px;
    margin: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 250px;
    right: 0;
    width: calc(100% - 250px);
    z-index: 1000;
}

.header h1 {
    font-size: 24px;
    color: #2c3e50;
}

.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ecf0f1;
}

.card-header h3 {
    color: #2c3e50;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 0 0 20px 0;
}

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

.stat-card h3 {
    color: #95a5a6;
    font-size: 14px;
    margin-bottom: 10px;
}

.stat-card .value {
    font-size: 28px;
    font-weight: bold;
    color: #2c3e50;
}

.stat-card.blue { border-left: 4px solid #3498db; }
.stat-card.green { border-left: 4px solid #2ecc71; }
.stat-card.orange { border-left: 4px solid #f39c12; }
.stat-card.red { border-left: 4px solid #e74c3c; }

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

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

table tr:hover {
    background: #f8f9fa;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-primary { background: #3498db; color: white; }
.btn-primary:hover { background: #2980b9; }

.btn-success { background: #2ecc71; color: white; }
.btn-success:hover { background: #27ae60; }

.btn-danger { background: #e74c3c; color: white; }
.btn-danger:hover { background: #c0392b; }

.btn-warning { background: #f39c12; color: white; }
.btn-warning:hover { background: #d68910; }

.btn-secondary { background: #95a5a6; color: white; }
.btn-secondary:hover { background: #7f8c8d; }

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

.btn-block {
    width: 100%;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.row {
    display: flex;
    gap: 20px;
}

.col {
    flex: 1;
}

.col-2 { flex: 2; }
.col-3 { flex: 3; }
.col-4 { flex: 4; }

.alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-danger {
    background: #fee;
    color: #c0392b;
    border: 1px solid #fcc;
}

.alert-success {
    background: #efe;
    color: #27ae60;
    border: 1px solid #cfc;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    font-weight: 500;
    word-break: break-word;
    max-width: 100%;
}

.badge-draft { background: #95a5a6; color: white; }
.badge-sent { background: #3498db; color: white; }
.badge-accepted { background: #2ecc71; color: white; }
.badge-rejected { background: #e74c3c; color: white; }
.badge-closed { background: #f39c12; color: white; }
.badge-active { background: #2ecc71; color: white; }
.badge-completed { background: #3498db; color: white; }
.badge-cancelled { background: #e74c3c; color: white; }
.badge-full { background: #2ecc71; color: white; }
.badge-half { background: #f39c12; color: white; }
.badge-in { background: #2ecc71; color: white; }
.badge-out { background: #e74c3c; color: white; }
.badge-low { background: #e74c3c; color: white; }

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.table-responsive table {
    min-width: 600px;
}

.calendar-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #ddd;
    border: 1px solid #ddd;
    min-width: 700px;
}

.calendar-header {
    background: #2c3e50;
    color: white;
    padding: 10px;
    text-align: center;
    font-weight: bold;
}

.calendar-day {
    background: white;
    padding: 10px;
    min-height: 80px;
    position: relative;
}

.calendar-day.empty {
    background: #f8f9fa;
}

.calendar-day.today {
    background: #fff3cd;
}

.calendar-day-number {
    font-weight: bold;
    margin-bottom: 5px;
}

.calendar-day-content {
    font-size: 11px;
}

.calendar-entry {
    background: #3498db;
    color: white;
    padding: 2px 5px;
    margin: 2px 0;
    border-radius: 2px;
    cursor: pointer;
    font-size: 10px;
}

.calendar-entry.half {
    background: #f39c12;
}

.calendar-entry:hover {
    opacity: 0.8;
}

.calendar-day.selected-day {
    background: #cce5ff !important;
    border: 2px solid #007bff;
}

.pagination {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-top: 20px;
}

.pagination a,
.pagination span {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
}

.pagination a:hover {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.pagination span {
    background: #3498db;
    color: white;
}

.actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #ecf0f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #ecf0f1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

@media print {
    .sidebar, .header, .btn, .no-print {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    body {
        background: white;
    }
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 15px;
    }
}

.mobile-menu-toggle {
    display: none;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 12px 18px;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(52, 152, 219, 0.3);
    transition: all 0.3s;
    align-items: center;
    gap: 8px;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 4001;
}

.mobile-menu-toggle:hover {
    background: #2980b9;
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.4);
}

.mobile-menu-toggle i {
    font-size: 16px;
}

.mobile-menu-toggle span {
    font-weight: 500;
}

.sidebar-close {
    display: none;
    background: #e74c3c;
    color: white;
    border: none;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s;
    position: absolute;
    top: 10px;
    right: 10px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(231, 76, 60, 0.3);
}

.sidebar-close:hover {
    background: #c0392b;
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.4);
    transform: scale(1.1);
}

.sidebar-close i {
    font-size: 16px;
}

@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
    }

    .mobile-menu-toggle {
        display: flex !important;
    }

    .sidebar {
        left: 0;
        transform: translateX(-100%);
        width: 260px;
        max-width: 85vw;
        z-index: 5000;
        box-shadow: 2px 0 10px rgba(0,0,0,0.3);
        position: fixed;
        top: 0;
        height: 100vh;
    }

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

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 4500;
    }

    .sidebar-overlay.active {
        display: block;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    body.sidebar-open .main-content {
        overflow-y: auto;
        transform: translateX(260px);
        transition: transform 0.3s ease;
    }

    .header {
        position: relative;
        left: 0;
        top: 0;
        width: 100%;
        padding: 12px 15px;
        margin-bottom: 15px;
        border-radius: 8px;
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
        margin-top: 55px;
    }

    .header h1 {
        font-size: 18px;
    }

    .user-info {
        width: 100%;
        justify-content: flex-end;
        gap: 10px;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 120px 12px 20px 12px;
        width: 100% !important;
        max-width: 100vw !important;
        left: 0;
        right: 0;
        transition: transform 0.3s ease;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .card {
        padding: 15px;
        margin-bottom: 15px;
        width: 100%;
        max-width: 100vw;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .card-header h3 {
        font-size: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        width: 100%;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-card h3 {
        font-size: 14px;
    }

    .stat-card .value {
        font-size: 24px;
    }

    .form-group label {
        font-size: 14px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px;
        font-size: 16px;
    }

    .btn {
        padding: 10px 15px;
        font-size: 14px;
    }

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

    table thead {
        display: none;
    }

    .table-responsive {
        margin: 0;
        overflow-x: auto;
    }

    table tbody tr {
        display: block;
        margin-bottom: 10px;
        border: 1px solid #eee;
        border-radius: 8px;
        background: white;
        padding: 10px;
    }

    table tbody tr td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid #f5f5f5;
    }

    table tbody tr td:before {
        content: attr(data-label);
        font-weight: 600;
        color: #2c3e50;
        margin-right: 10px;
        flex-shrink: 0;
        min-width: 120px;
        font-size: 13px;
    }

    .row {
        flex-direction: column;
        gap: 15px;
    }

    .col {
        width: 100%;
    }

    .alert {
        padding: 12px 15px;
        font-size: 14px;
        width: 100%;
    }

    .calendar-wrapper {
        overflow-x: auto;
    }

    .calendar {
        min-width: 600px;
    }

    .modal-content {
        width: 95%;
        margin: 10px;
        max-width: 90vw;
    }

    .modal-header h2 {
        font-size: 18px;
    }

    .modal-body {
        padding: 15px;
    }

    .modal-footer {
        padding: 15px;
        flex-wrap: wrap;
        gap: 10px;
    }
}

@media (max-width: 576px) {
    .main-content {
        padding: 120px 10px 20px 10px;
    }

    .header h1 {
        font-size: 16px;
    }

    .card {
        padding: 12px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-card h3 {
        font-size: 12px;
    }

    .stat-card .value {
        font-size: 20px;
    }

    .mobile-menu-toggle {
        padding: 8px 12px;
        font-size: 13px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .btn-sm {
        padding: 5px 8px;
        font-size: 12px;
    }

    .form-group label {
        font-size: 13px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 8px 10px;
        font-size: 14px;
    }

    table tbody tr td {
        padding: 6px 0;
        font-size: 13px;
    }
    
    table tbody tr td:first-child {
        border-top: none;
    }
}

@media (max-width: 768px) {
    .mobile-cards .cards-title {
        color: #2c3e50;
        margin-bottom: 20px;
        font-size: 18px;
        font-weight: 600;
    }
    
    .mobile-cards .card {
        background: white;
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        margin-bottom: 15px;
        overflow: hidden;
    }
    
    .mobile-cards .card-header {
        background: #2c3e50;
        color: white;
        padding: 12px 15px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .mobile-cards .card-title {
        font-weight: bold;
        font-size: 14px;
        color: white;
    }
    
    .mobile-cards .card-body {
        padding: 15px;
    }
    
    .mobile-cards .info-grid {
        display: grid;
        gap: 8px;
        margin-bottom: 15px;
    }
    
    .mobile-cards .info-item {
        font-size: 13px;
        line-height: 1.4;
    }
    
    .mobile-cards .info-item strong {
        color: #2c3e50;
        font-weight: 600;
    }
}

@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none !important;
    }

    .sidebar-close {
        display: none !important;
    }
    
    .sidebar-header {
        padding: 20px 20px 20px 20px;
    }

    .sidebar {
        transform: none !important;
        left: 0;
    }

    body.sidebar-open .main-content {
        transform: none !important;
    }
}