/* --- CSS GLOBAL (dashboard e geral) --- */
body {
    margin: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #f6faff;
    color: #222;
}

/* Garantir que larguras/paddings não causem overflow no mobile */
*, *::before, *::after {
    box-sizing: border-box;
}

/* --- LOGIN E REGISTO --- */
.login-bg {
    background: linear-gradient(135deg, #e3f0ff 0%, #f6faff 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-container {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.07);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 350px;
    text-align: center;
}
.login-container h1 {
    color: #4a90e2;
    margin-bottom: 1.5rem;
}
.login-container input {
    width: 100%;
    padding: 0.7rem;
    margin: 0.5rem 0;
    border: 1px solid #e3e3e3;
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
}
.login-container button {
    width: 100%;
    padding: 0.7rem;
    background: #4a90e2;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    margin-top: 1rem;
    cursor: pointer;
    transition: background 0.2s;
    box-sizing: border-box;
}
.login-container button:hover {
    background: #357ab8;
}
.login-container a {
    color: #4a90e2;
    text-decoration: none;
}

header {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
header h1 {
    color: #4a90e2;
    font-size: 2rem;
    margin: 0;
}
nav a {
    color: #4a90e2;
    font-weight: 500;
    text-decoration: none;
    margin-left: 1rem;
}
nav a:hover {
    text-decoration: underline;
}

.user-name {
    color: #4a90e2;
    font-weight: 600;
    margin-right: 1.5rem;
}

main {
    max-width: 1200px;
    margin: 2rem auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.07);
    padding: 2rem;
    width: 100%;
    box-sizing: border-box;
}

/* --- CALENDÁRIO --- */
.calendar-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1.5rem 2rem;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.15);
    color: white;
}

/* Visualização mensal com pontos coloridos e horários */
.month-shifts-container {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

/* Visualização mensal com pontos coloridos e horários - consolidado */
.month-items-container {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.month-shift-item,
.month-event-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    line-height: 1;
    padding: 0 2px;
    min-height: 16px;
}

.month-event-item {
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.month-event-item:hover {
    background: rgba(0,0,0,0.05);
}

.month-shift-dot,
.month-event-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
}

.month-shift-time,
.month-event-title {
    color: #666;
    font-size: 0.65rem;
    white-space: nowrap;
}

.month-shift-time {
    font-family: monospace;
}

.month-event-title {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}

.view-controls {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.view-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    color: white;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
}

.view-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.view-btn:hover::before {
    left: 100%;
}

.view-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.view-btn.active {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.6);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.navigation-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.navigation-controls button {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.navigation-controls button:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.navigation-controls span {
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    min-width: 200px;
    text-align: center;
}

.event-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
#calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1rem;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 20px;
    padding: 2rem;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-sizing: border-box;
}
#calendar .day {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
    border-radius: 16px;
    min-height: 120px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 1rem;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: visible !important;
    z-index: 1;
    border: 1px solid rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
}

#calendar .day:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.3);
}

#calendar .day.today {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    border-color: rgba(255, 255, 255, 0.3);
}

#calendar .day.today .day-number {
    color: white;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Estilos específicos para visualização semanal */
#calendar.week-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    grid-template-columns: none;
}

.week-day-container {
    background: #fff;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    cursor: pointer;
    transition: box-shadow 0.2s;
    border: 1px solid #f0f0f0;
}

.week-day-container:hover {
    box-shadow: 0 4px 16px rgba(74,144,226,0.10);
}

.week-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.week-day-name {
    font-weight: 600;
    color: #4a90e2;
    font-size: 1rem;
}

.week-day-number {
    font-weight: 600;
    color: #666;
    font-size: 1rem;
    white-space: nowrap;
}

.week-day-number.today {
    background: #e74c3c;
    color: #fff;
    border-radius: 50%;
    padding: 4px 8px;
    font-size: 0.9rem;
}

.week-shifts-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.week-shift-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem;
    background: #f8f9ff;
    border-radius: 6px;
    border: 1px solid #e3e3e3;
}

.week-shift-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.week-job-name {
    font-weight: 600;
    color: #333;
    flex: 1;
    font-size: 0.95rem;
}

.week-shift-time {
    font-weight: 500;
    color: #666;
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
    background: rgba(255, 255, 255, 0.8);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.week-empty-day {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 1rem;
    font-size: 0.9rem;
}

.week-events-container {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.week-event-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.5rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 6px;
    border: 1px solid #e3e3e3;
    font-size: 0.85rem;
}

.week-event-item:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: #4a90e2;
}

.week-event-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.week-event-title {
    font-weight: 500;
    color: #333;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.week-event-time {
    font-size: 0.75rem;
    color: #666;
    margin-left: auto;
}
#calendar .day:hover {
    box-shadow: 0 4px 16px rgba(74,144,226,0.10);
}
.shift {
    display: block;
    border-radius: 6px;
    padding: 0.2rem 0.5rem;
    margin: 0.2rem 0;
    font-size: 0.95rem;
    color: #fff;
    font-weight: 500;
}
.shift.user1 {
    background: #4a90e2;
}
.shift.user2 {
    background: #f78da7;
}

/* --- MODAL --- */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal.hidden {
    display: none;
}
.modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 24px rgba(0,0,0,0.10);
    min-width: 320px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
}

/* --- ALERTAS --- */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.alert-error {
    background: #ffe3e3;
    color: #c0392b;
    border: 1px solid #ffb3b3;
}
.alert-success {
    background: #e3ffe9;
    color: #27ae60;
    border: 1px solid #b3ffd1;
}

.day-number {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 1.1rem;
    color: #667eea;
    font-weight: 700;
    pointer-events: none;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(102, 126, 234, 0.2);
    transition: all 0.3s ease;
}

.day-number.today {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    transform: scale(1.1);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1.1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1.1); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 1.5rem;
    font-weight: 700;
    color: #667eea;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 249, 255, 0.9) 100%);
    border-radius: 16px;
    padding: 1.5rem 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}
.calendar-weekday {
    text-align: center;
    padding: 0.75rem 0.5rem;
    font-size: 1.1rem;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    font-weight: 700;
    color: #667eea;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
}

.calendar-weekday::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
}
.shift-dot {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
    position: relative;
    z-index: 1000;
    opacity: 1;
    pointer-events: none;
    margin: 0;
    transition: all 0.3s ease;
}

.shift-dot:hover {
    transform: scale(1.2);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.5);
}
.shift-dot-group {
    display: flex;
    gap: 4px;
    position: absolute;
    left: 50%;
    bottom: 2px;
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: none;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 85%;
    padding: 0 2px;
}

.day-time-range {
    font-size: 0.7rem;
    font-weight: 600;
    color: #333;
    background: rgba(255, 255, 255, 0.98);
    padding: 1px 2px;
    border-radius: 2px;
    border: 1px solid #ddd;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    font-family: 'Courier New', monospace;
    letter-spacing: 0.2px;
    min-width: 35px;
    max-width: 100%;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1;
}

/* Responsivo para telemóveis */
@media (max-width: 600px) {
    .day-time-range {
        font-size: 0.5rem;
        padding: 0.5px;
        min-width: 25px;
        max-width: 100%;
        letter-spacing: 0.05px;
        line-height: 1.1;
        white-space: normal;
        word-break: break-all;
        text-align: center;
    }
    
    .shift-dot-group {
        gap: 2px;
        bottom: 1px;
        max-width: 90%;
        flex-wrap: wrap;
    }
    
    .shift-dot {
        width: 6px;
        height: 6px;
    }
}

/* Para ecrãs muito pequenos onde o scroll horizontal é necessário */
@media (max-width: 480px) {
    #calendar {
        min-width: 350px; /* Forçar scroll horizontal em ecrãs muito pequenos */
        overflow-x: auto;
    }
    
    #calendar .day {
        min-width: 45px; /* Garantir largura mínima para cada dia */
    }
}

/* Para ecrãs muito pequenos */
@media (max-width: 400px) {
    /* Header para ecrãs muito pequenos */
    header {
        padding: 0.6rem 0.8rem;
        gap: 0.6rem;
    }
    
    header h1 {
        font-size: 1.3rem;
    }
    
    nav {
        gap: 0.5rem;
    }
    
    nav span {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }
    
    nav a {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
    }
    
    main {
        padding: 0.2rem;
        margin: 0.8rem auto;
    }
    
    .calendar-controls {
        padding: 0 0.3rem;
    }
    
    #calendar .day {
        min-height: 50px;
        font-size: 0.8rem;
        padding: 0.2rem;
        min-width: 35px;
    }
    
    .day-number {
        font-size: 0.8rem;
    }
    
    .day-time-range {
        font-size: 0.5rem;
        min-width: 28px;
        max-width: 100%;
    }
    
    .shift-dot-group {
        gap: 0.1rem;
    }
    
    .shift-dot {
        width: 6px;
        height: 6px;
    }
    
    .week-day-container {
        padding: 0.3rem;
        min-width: 100px;
    }
    
    .week-day-name {
        font-size: 0.7rem;
    }
    
    .week-day-number {
        font-size: 0.7rem;
    }
    
    .week-job-name {
        font-size: 0.7rem;
        min-width: 50px;
    }
    
    .week-shift-time {
        font-size: 0.6rem;
        padding: 1px 2px;
    }
    
    #summary table {
        font-size: 0.7rem;
    }
    
    #summary table th,
    #summary table td {
        padding: 0.2rem 0.1rem;
        min-width: 50px;
    }
}
/* Estilos consolidados para detalhes (otimização) */
.shift-detail,
.event-detail {
    margin: 0.5rem 0;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    color: #222;
    font-size: 1.05rem;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    background: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #e3e3e3;
}

.shift-detail em,
.event-detail em {
    font-size: 0.95rem;
    color: #666;
    font-style: italic;
}
.shift-modal-modern {
    min-width: 320px;
    max-width: 95vw;
    width: 100%;
    padding: 2.5rem 2rem;
    box-sizing: border-box;
    max-height: 90vh;
    overflow-y: auto;
}
.shift-modal-modern h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: #4a90e2;
    font-size: 1.4rem;
    text-align: center;
}

/* --- FORMULÁRIOS --- */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.1rem;
}
.form-group label {
    margin-bottom: 0.4rem;
    font-weight: 500;
    color: #4a90e2;
    font-size: 1rem;
}
.form-group input[type="date"],
.form-group input[type="text"],
.form-group select {
    padding: 0.6rem 0.8rem;
    border: 1px solid #e3e3e3;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border 0.2s;
    background: #f6faff;
}
.form-group input[type="date"]:focus,
.form-group input[type="text"]:focus,
.form-group select:focus {
    border: 1.5px solid #4a90e2;
    background: #fff;
}
.form-group input[type="color"] {
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    margin-top: 0.2rem;
    align-self: flex-start;
}
.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* --- BOTÕES --- */
.btn-primary {
    background: #4a90e2;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.7rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-primary:hover {
    background: #357ab8;
}
.btn-secondary {
    background: #e3e3e3;
    color: #222;
    border: none;
    border-radius: 8px;
    padding: 0.7rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 0.2rem;
    margin-right: 0.5rem;
    width: auto;
    display: inline-block;
}
.btn-secondary:hover {
    background: #d1d8e0;
    color: #222;
}

.styled-select {
    padding: 0.6rem 0.8rem;
    border: 1px solid #e3e3e3;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    background: #f6faff;
    color: #222;
    transition: border 0.2s;
    margin-left: 1rem;
    min-width: 120px;
}
.styled-select:focus {
    border: 1.5px solid #4a90e2;
    background: #fff;
}

/* --- CSS EXCLUSIVO PARA DEFINIÇÕES --- */
.settings-main {
    max-width: 480px;
    margin: 2.5rem auto;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 4px 24px rgba(74,144,226,0.07);
    padding: 2rem 1.2rem;
}
.settings-main h1, .settings-main h2 {
    margin-top: 0;
    color: #222;
}
.settings-main h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
}
.settings-main h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.7rem;
}
.settings-main section {
    margin-bottom: 2rem;
}
.settings-main #jobs-list ul {
    list-style: disc inside;
    margin-bottom: 1rem;
    padding-left: 1.2rem;
}
.settings-main #jobs-list li {
    margin-bottom: 0.7rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}
.settings-main #jobs-list a {
    color: #4a90e2;
    text-decoration: none;
    font-weight: 600;
    margin-right: 0.3rem;
}
.settings-main #jobs-list a:hover {
    text-decoration: underline;
    color: #357ab8;
}
.settings-main form {
    margin-bottom: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}
.settings-main form input[type="text"],
.settings-main form input[type="number"],
.settings-main form input[type="time"],
.settings-main form select {
    padding: 0.7rem 1rem;
    border: 1px solid #e3e3e3;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    background: #f6faff;
    box-shadow: 0 1px 4px rgba(74,144,226,0.04);
    transition: border 0.2s, box-shadow 0.2s;
    width: 100%;
    box-sizing: border-box;
}
.settings-main form input[type="text"]:focus, .settings-main form input[type="number"]:focus, .settings-main form input[type="time"]:focus, .settings-main form select:focus {
    border: 1.5px solid #4a90e2;
    background: #fff;
    box-shadow: 0 2px 8px rgba(74,144,226,0.10);
}
.settings-main form label {
    font-weight: 500;
    color: #4a90e2;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.settings-main input[type="checkbox"] {
    accent-color: #4a90e2;
    margin-left: 0.5rem;
}
.settings-main button, .settings-main input[type="submit"] {
    background: #4a90e2;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.8rem 1.2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(74,144,226,0.07);
    margin-right: 0;
    width: 100%;
    box-sizing: border-box;
}
.settings-main button:hover, .settings-main input[type="submit"]:hover {
    background: #357ab8;
}

/* Garantir que botões .btn-secondary nas definições mantenham o estilo correto */
.settings-main .btn-secondary {
    background: #e3e3e3;
    color: #222;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 0.2rem;
    width: 100%;
    display: block;
    box-sizing: border-box;
}

.settings-main .btn-secondary:hover {
    background: #d1d8e0;
    color: #222;
}

/* Botão para o nome do trabalho - estilo diferente mas consistente */
.settings-main .btn-job-name {
    background: transparent;
    color: #4a90e2;
    border: 1px solid #4a90e2;
    border-radius: 8px;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    display: block;
    text-decoration: none;
    box-sizing: border-box;
}

.settings-main .btn-job-name:hover {
    background: #4a90e2;
    color: #fff;
}

.settings-main .btn-job-name.selected {
    background: #4a90e2;
    color: #fff;
    font-weight: 700;
}

.settings-main table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(74,144,226,0.04);
    margin-bottom: 1.5rem;
    font-size: 0.98rem;
    overflow-x: auto;
    display: block;
}
.settings-main table th, .settings-main table td {
    padding: 0.7rem 0.5rem;
    text-align: left;
    min-width: 90px;
}
.settings-main table th {
    background: #f6faff;
    color: #4a90e2;
    font-weight: 600;
}
.settings-main table tr:nth-child(even) {
    background: #f9fbff;
}

/* --- RESUMO MENSAL --- */
#summary {
    margin-top: 3rem;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

#summary h2 {
    color: #667eea;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

#summary h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
}

#summary table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.1);
}

#summary table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

#summary table th {
    padding: 1.5rem 1rem;
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border: none;
    position: relative;
}

#summary table th:first-child {
    text-align: left;
    padding-left: 2rem;
}

#summary table th:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 20%;
    height: 60%;
    width: 1px;
    background: rgba(255, 255, 255, 0.3);
}

#summary table td {
    padding: 1.25rem 1rem;
    text-align: center;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
}

#summary table td:first-child {
    text-align: left;
    padding-left: 2rem;
    font-weight: 600;
    color: #667eea;
}

#summary table tr:hover td {
    background: rgba(102, 126, 234, 0.05);
    transform: scale(1.01);
}

#summary table tr:last-child td {
    border-bottom: none;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    font-weight: 700;
    color: #667eea;
}

#summary table tr:nth-child(even) td {
    background: rgba(248, 249, 255, 0.5);
}

#summary table tr:nth-child(even):hover td {
    background: rgba(102, 126, 234, 0.08);
}

/* --- MEDIA QUERIES --- */
@media (max-width: 700px) {
    .settings-main {
        padding: 1rem 0.2rem;
        max-width: 99vw;
    }
    .settings-main table th, .settings-main table td {
        padding: 0.4rem 0.2rem;
        font-size: 0.95rem;
    }
    .settings-main h1 {
        font-size: 1.3rem;
    }
    .settings-main h2 {
        font-size: 1.05rem;
    }
    .settings-main button, .settings-main input[type="submit"] {
        font-size: 0.98rem;
        padding: 0.7rem 1rem;
    }
    .settings-main .btn-secondary {
        font-size: 0.95rem;
        padding: 0.6rem 1rem;
        background: #e3e3e3;
        color: #222;
    }
    .settings-main .btn-job-name {
        font-size: 0.95rem;
        padding: 0.6rem 1rem;
    }
}
@media (max-width: 600px) {
    /* Respeitar áreas seguras do iOS e evitar cortes no fundo/topo */
    header {
        padding-top: calc(1rem + env(safe-area-inset-top));
    }
    main {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }

    /* Header mobile */
    header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
    }
    
    header h1 {
        font-size: 1.8rem;
        margin: 0;
        color: white;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    
    nav {
        display: flex;
        gap: 0.8rem;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    /* Nome do utilizador no header */
    .user-name {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
        background: rgba(255, 255, 255, 0.2);
        color: white !important;
        border-radius: 20px;
        font-weight: 600;
        margin-right: 0;
        border: 1px solid rgba(255, 255, 255, 0.3);
        backdrop-filter: blur(10px);
    }
    
    nav a {
        margin-left: 0;
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
        background: rgba(255, 255, 255, 0.15);
        border-radius: 20px;
        transition: all 0.3s ease;
        text-decoration: none;
        color: white;
        border: 1px solid rgba(255, 255, 255, 0.2);
        backdrop-filter: blur(10px);
    }
    
    nav a:hover {
        background: rgba(255, 255, 255, 0.25);
        transform: translateY(-2px);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
        text-decoration: none;
    }
    
    main {
        padding: 1rem;
        max-width: 100vw;
        overflow-x: hidden;
        margin: 1rem auto;
    }
    
    .calendar-controls {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem;
        margin-bottom: 1rem;
        width: 100%;
    }
    
    .view-controls {
        justify-content: center;
        width: 100%;
        flex-wrap: wrap;
    }
    
    .navigation-controls {
        justify-content: center;
        width: 100%;
        flex-wrap: wrap;
    }
    
    .navigation-controls span {
        font-size: 1.1rem;
        min-width: auto;
    }
    
    #calendar {
        width: 100%;
        overflow-x: auto;
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        gap: 0.5rem;
        padding: 0.75rem;
        min-width: 320px; /* Garantir largura mínima para 7 colunas */
    }
    
    #calendar .day {
        min-height: 70px;
        font-size: 0.75rem;
        padding: 0.4rem;
        min-width: 0; /* Permitir que os dias se ajustem automaticamente */
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        border-radius: 12px;
        aspect-ratio: 1; /* Manter proporção quadrada */
    }
    
    .day-number {
        font-size: 0.8rem;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 0.1rem;
        position: absolute;
        top: 6px;
        right: 6px;
        background: rgba(102, 126, 234, 0.1);
        width: 24px;
        height: 24px;
        border-radius: 50%;
        border: 2px solid rgba(102, 126, 234, 0.2);
    }
    
    /* Container para turnos e eventos no mobile */
    .month-items-container {
        position: absolute;
        bottom: 2px;
        left: 2px;
        right: 2px;
        display: flex;
        flex-direction: column;
        gap: 1px;
        max-height: 45px;
        overflow: hidden;
    }
    
    .month-shift-item, .month-event-item {
        display: flex;
        align-items: center;
        gap: 1px;
        font-size: 0.4rem;
        padding: 0.5px 1px;
        background: rgba(255,255,255,0.95);
        border-radius: 2px;
        border: 1px solid rgba(0,0,0,0.1);
        max-width: 100%;
        margin-bottom: 0.5px;
    }
    
    .month-shift-dot, .month-event-dot {
        width: 3px;
        height: 3px;
        border-radius: 50%;
        flex-shrink: 0;
    }
    
    .month-shift-time, .month-event-title {
        font-size: 0.4rem;
        line-height: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    
    /* Visualização semanal mobile */
    #calendar.week-view {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        padding: 0 0.3rem;
    }
    
    .week-day-container {
        padding: 0.5rem;
        min-width: 100%;
        border: 1px solid #e3e3e3;
        border-radius: 8px;
        background: #fff;
    }
    
    .week-day-header {
        margin-bottom: 0.4rem;
        padding-bottom: 0.3rem;
        border-bottom: 1px solid #e3e3e3;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .week-day-name {
        font-size: 0.8rem;
        font-weight: 600;
        color: #4a90e2;
    }
    
    .week-day-number {
        font-size: 0.8rem;
        white-space: nowrap;
        background: #4a90e2;
        color: #fff;
        padding: 2px 6px;
        border-radius: 4px;
    }
    
    .week-shift-item, .week-event-item {
        padding: 0.3rem;
        gap: 0.4rem;
        flex-wrap: wrap;
        display: flex;
        align-items: center;
        margin-bottom: 0.3rem;
        background: #f6faff;
        border-radius: 4px;
        border: 1px solid #e3e3e3;
    }
    
    .week-job-name, .week-event-title {
        font-size: 0.8rem;
        flex: 1;
        min-width: 60px;
        font-weight: 500;
    }
    
    .week-shift-time, .week-event-time {
        font-size: 0.7rem;
        padding: 2px 4px;
        background: #4a90e2;
        color: #fff;
        border-radius: 3px;
        white-space: nowrap;
        font-family: monospace;
    }
    
    /* Melhorar tabela de resumo para mobile */
    #summary {
        padding: 1.5rem;
        margin-top: 2rem;
    }
    
    #summary h2 {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    #summary table {
        font-size: 0.8rem;
        max-width: 100vw;
        overflow-x: auto;
        display: block;
        border-radius: 12px;
    }
    
    #summary table th,
    #summary table td {
        padding: 0.8rem 0.4rem;
        min-width: 60px;
        text-align: center;
        font-size: 0.75rem;
    }
    
    #summary table th:first-child,
    #summary table td:first-child {
        padding-left: 0.8rem;
        min-width: 80px;
    }
    
    #summary table th {
        font-size: 0.7rem;
        padding: 1rem 0.4rem;
    }
    
    .modal-content {
        padding: 0.8rem;
        max-height: 95vh;
        overflow-y: auto;
        margin: 0.5rem;
        max-width: calc(100vw - 1rem);
    }
    
    .shift-modal-modern {
        padding: 0.8rem 0.4rem;
        max-height: 95vh;
        overflow-y: auto;
        margin: 0.5rem;
        max-width: calc(100vw - 1rem);
    }
    
    .form-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Inputs e botões a 100% para evitar cortes laterais */
    .styled-select {
        width: 100%;
        margin-left: 0;
    }
    .event-controls .btn-primary,
    .btn-primary {
        width: 100%;
    }
} 