:root {
    --bg-color: #f4f6f9;
    --card-bg: #ffffff;
    --text-color: #333333;
    --text-muted: #666666;
    --primary-color: #007aff;
    --primary-hover: #005bb5;
    --border-color: #e0e0e0;
    --danger-color: #ff3b30;
    --success-color: #34c759;
    --c-normal: #e3f2fd;
    --c-extra: #fff9c4;
    --c-nocturna: #ede7f6;
    --c-sabado: #e8f5e9;
    --c-domingo: #ffebee;
    --c-festiva: #fce4ec;
}

body.dark-mode {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-color: #f4f6f9;
    --text-muted: #aaaaaa;
    --primary-color: #0a84ff;
    --primary-hover: #005ec4;
    --border-color: #2c2c2e;
    --danger-color: #ff453a;
    --success-color: #30d158;
    --c-normal: #1c3144;
    --c-extra: #3b3713;
    --c-nocturna: #2d1a3a;
    --c-sabado: #1b381e;
    --c-domingo: #3d1c1c;
    --c-festiva: #3d1c29;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s, color 0.3s;
}

.screen {
    display: none;
    width: 100%;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    background-color: var(--bg-color);
    overflow-y: auto;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* Login */
.login-container {
    margin: auto;
    width: 90%;
    max-width: 400px;
    padding: 30px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    text-align: center;
}

.login-logo {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.login-container h1 {
    margin-bottom: 5px;
}

.login-container p {
    color: var(--text-muted);
    margin-bottom: 25px;
}

/* App Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* Sections */
.section {
    display: none;
    flex: 1;
    padding: 20px;
    padding-bottom: 80px;
    overflow-y: auto;
}

.section.active {
    display: block;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Form Elements */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    font-weight: 500;
}

.req {
    color: var(--danger-color);
}

input, select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 16px;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.info-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.btn-danger {
    background-color: var(--danger-color);
    color: #ffffff;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-color);
    cursor: pointer;
    padding: 5px;
}

.btn-large {
    width: 100%;
}

.w-100 { width: 100%; }
.mt-10 { margin-top: 10px; }
.mt-15 { margin-top: 15px; }
.mb-10 { margin-bottom: 10px; }
.mb-15 { margin-bottom: 15px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary-color); }

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
}

.nav-item i {
    font-size: 22px;
    margin-bottom: 2px;
}

.nav-item.active {
    color: var(--primary-color);
}

/* Calendar */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.calendar-grid-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-color);
    cursor: pointer;
    user-select: none;
    transition: transform 0.1s;
}

.cal-day:hover {
    opacity: 0.8;
}

.cal-day.empty {
    background: transparent;
    cursor: default;
}

.cal-day.weekend {
    color: var(--text-muted);
}

.cal-day.holiday {
    border: 2px dashed var(--danger-color);
}

.bg-normal { background-color: var(--c-normal) !important; }
.bg-extra { background-color: var(--c-extra) !important; }
.bg-nocturna { background-color: var(--c-nocturna) !important; }
.bg-sabado { background-color: var(--c-sabado) !important; }
.bg-domingo { background-color: var(--c-domingo) !important; }
.bg-festiva { background-color: var(--c-festiva) !important; }

.export-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.export-actions button {
    flex: 1;
}

/* Resume Card */
.resume-title {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.resume-card h1 {
    font-size: 36px;
    margin: 10px 0 20px 0;
    color: var(--primary-color);
}

.resume-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
}

.stat-box i {
    font-size: 18px;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-box small {
    font-weight: normal;
    color: var(--text-muted);
    font-size: 11px;
}

/* Chart */
.chart-container {
    position: relative;
    height: 200px;
    width: 100%;
}

/* Contract List */
.lista-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.item-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.item-info h4 {
    margin-bottom: 3px;
}

.item-info p {
    font-size: 13px;
    color: var(--text-muted);
}

.item-actions {
    display: flex;
    gap: 8px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.modal-content h3 {
    margin-bottom: 15px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Toggle Switch */
.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.setting-section {
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
    margin-top: 15px;
}

.setting-section h4 {
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--text-muted);
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.error-msg {
    color: var(--danger-color);
    font-size: 13px;
    margin-bottom: 15px;
    text-align: center;
}