:root {
    --acv-navy: #1a2a4a;
    --acv-navy-light: #2a3f6a;
    --acv-red: #c41e3a;
    --acv-red-dark: #9e1830;
    --bg: #f4f6f9;
    --card: #ffffff;
    --text: #1a1a2e;
    --muted: #6b7280;
    --border: #e2e8f0;
    --success: #16a34a;
    --error: #dc2626;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(26, 42, 74, 0.08);
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header {
    background: #fff;
    color: var(--text);
    padding: 10px 0;
    box-shadow: var(--shadow);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo { height: 48px; width: auto; }

.main-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.main-nav a {
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 6px 10px;
    border-radius: 4px;
    transition: background 0.2s;
}

.main-nav a:hover { background: var(--bg); }
.nav-admin { color: var(--acv-red) !important; font-weight: 600; }
.nav-user { font-size: 0.85rem; color: var(--muted); }

.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--text);
    color: var(--text);
    font-size: 1.4rem;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
}

/* Main */
.main-content { flex: 1; padding: 24px 16px; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.page-header h1 {
    margin: 0;
    color: var(--acv-navy);
    font-size: 1.5rem;
}

/* Cards */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9rem; }

input[type="text"], input[type="email"], input[type="password"],
input[type="tel"], input[type="date"], input[type="time"], input[type="number"],
select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--acv-navy);
    box-shadow: 0 0 0 3px rgba(26, 42, 74, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Licenças PU / PPL no perfil */
.license-blocks { margin-bottom: 16px; }
.license-blocks__intro { margin: 0 0 14px; max-width: 52rem; }
.license-blocks__row { align-items: stretch; }

.license-block {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    background: #f8fafc;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.license-block--active {
    background: #fff;
    border-color: rgba(26, 42, 74, 0.35);
    box-shadow: 0 0 0 3px rgba(26, 42, 74, 0.06);
}

.license-block__toggle {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 12px;
}

.license-block__toggle input {
    width: auto;
    margin-top: 3px;
    flex-shrink: 0;
}

.license-block__title {
    font-size: 0.95rem;
    line-height: 1.35;
}

.license-block__title strong {
    color: var(--acv-navy);
}

.license-block__date label {
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 600;
}

.license-block__date input:disabled {
    background: #eef1f5;
    color: var(--muted);
    cursor: not-allowed;
}

.license-block__hint {
    margin: 8px 0 0;
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.4;
}

.license-block--active .license-block__hint {
    color: #4b5563;
}

/* Qualificações livres (só alertas) */
.extra-quals {
    margin: 8px 0 20px;
    padding: 16px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: #fafbfc;
}

.extra-quals__title {
    margin: 0 0 6px;
    font-size: 1.05rem;
    color: var(--acv-navy);
}

.extra-quals__intro { margin: 0 0 14px; }

.extra-qual-row {
    display: grid;
    grid-template-columns: 1.4fr 1fr auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.extra-qual-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.extra-qual-row .form-group { margin-bottom: 0; }

.extra-quals__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}

@media (max-width: 640px) {
    .extra-qual-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
}

.form-check label { font-weight: normal; display: flex; gap: 8px; align-items: flex-start; }
.form-check input { width: auto; margin-top: 4px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    text-align: center;
}

.btn-primary { background: var(--acv-navy); color: #fff; }
.btn-primary:hover { background: var(--acv-navy-light); }
.btn-warning { background: #d97706; color: #fff; }
.btn-warning:hover { background: #b45309; }
.compliance-warning { margin-bottom: 1rem; text-align: left; }
.compliance-warning ul { margin: 0.5rem 0 0.75rem 1.25rem; }

.btn-outline { background: transparent; color: var(--acv-navy); border-color: var(--acv-navy); }
.btn-outline:hover { background: var(--acv-navy); color: #fff; }
.btn-outline.active { background: var(--acv-navy); color: #fff; }

.btn-danger { background: var(--acv-red); color: #fff; border-color: var(--acv-red); }
.btn-danger:hover { background: var(--acv-red-dark); }

.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-block { width: 100%; }

.btn-group { display: flex; gap: 6px; }

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.alert-success { background: #dcfce7; color: #166534; border-left: 4px solid var(--success); }
.alert-error { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--error); }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid #f59e0b; }

/* Auth */
.auth-card {
    max-width: 420px;
    margin: 40px auto;
    background: var(--card);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.auth-card-wide { max-width: 560px; }
.auth-logo { display: block; margin: 0 auto 20px; max-width: 220px; height: auto; }
.auth-card h1 { text-align: center; color: var(--acv-navy); margin: 0 0 24px; font-size: 1.4rem; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 0.9rem; }
.auth-footer a { color: var(--acv-red); }

/* Honeypot */
.hp-field { position: absolute; left: -9999px; height: 0; overflow: hidden; }

/* Calendar */
.calendar-wrap { padding: 12px; }
.calendar-controls { margin-bottom: 16px; }

.legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 12px;
    font-size: 0.85rem;
}

.legend-item { display: flex; align-items: center; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot-busy { background: var(--acv-red); }
.dot-own { background: #16a34a; }
.dot-pending { background: #9ca3af; }
.dot-block { background: #555; }
.dot-maintenance { background: #d97706; }
.dot-inop { background: #7f1d1d; }
.dot-acv-service { background: #1a2a4a; }
.dot-instruction { background: #7c3aed; }
.legend-admin { color: var(--muted); font-style: italic; }
.legend-note { color: var(--muted); font-style: italic; }

.time-note { font-size: 0.85rem; color: var(--muted); }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal-overlay[hidden] { display: none; }

.modal-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    max-width: 420px;
    width: 100%;
    padding: 20px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-header h2 { margin: 0; font-size: 1.15rem; }

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
    padding: 0 4px;
}

.info-list {
    margin: 0 0 16px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 16px;
    font-size: 0.95rem;
}

.info-list dt {
    font-weight: 600;
    color: var(--muted);
}

.info-list dd { margin: 0; }

.modal-actions { text-align: right; }

.time-preview {
    background: #f0f4ff;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    margin-bottom: 16px;
    color: var(--acv-navy);
}

.zulu { color: var(--muted); font-size: 0.85em; }

/* Reservations list */
.reservation-list { display: grid; gap: 16px; }
.reservation-card.past { opacity: 0.65; }
.reservation-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.reservation-dates { font-size: 0.9rem; margin-bottom: 8px; }
.reservation-dates small { color: var(--muted); display: block; }
.reservation-actions { display: flex; gap: 8px; margin-top: 12px; }
.inline-form { display: inline; }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-viagem { background: #dbeafe; color: #1e40af; }
.badge-local { background: #d1fae5; color: #065f46; }
.badge-status-confirmed { background: #dcfce7; color: #166534; }
.badge-status-pending { background: #ffedd5; color: #c2410c; }
.badge-status-rejected { background: #fef3c7; color: #92400e; }
.badge-status-cancelled { background: #fee2e2; color: #991b1b; }
.badge-block-maintenance { background: #ffedd5; color: #c2410c; }
.badge-block-inop { background: #fee2e2; color: #7f1d1d; }
.badge-block-acv_service { background: #e0e7ff; color: #1a2a4a; }
.badge-block-instruction { background: #ede9fe; color: #5b21b6; }

.status-note { margin: 8px 0 0; font-size: 0.9rem; }
.status-note-pending { color: #c2410c; }
.status-note-confirmed { color: #166534; }
.status-note-rejected { color: #92400e; }

.reservation-card.status-rejected { opacity: 0.92; }

.reject-form { display: flex; flex-direction: column; gap: 6px; min-width: 180px; margin-top: 6px; }
.reject-reason-input { width: 100%; font-size: 0.85rem; padding: 6px; border: 1px solid var(--border); border-radius: 4px; resize: vertical; }

/* Tables */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { background: var(--acv-navy); color: #fff; font-weight: 600; }
.data-table tr:hover { background: #f8fafc; }
.cancelled-row { opacity: 0.5; }
.actions-cell { white-space: nowrap; }

/* Admin */
.admin-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    padding: 16px;
}

.admin-nav a {
    display: block;
    padding: 14px;
    text-align: center;
    background: var(--bg);
    border-radius: var(--radius);
    color: var(--acv-navy);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.admin-nav a:hover { background: var(--acv-navy); color: #fff; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card { text-align: center; padding: 24px 16px; }
.stat-value { display: block; font-size: 2rem; font-weight: 700; color: var(--acv-red); }
.stat-label { font-size: 0.85rem; color: var(--muted); }

.empty-state { text-align: center; padding: 40px; }
.empty-state p { color: var(--muted); margin-bottom: 16px; }

/* Footer */
.site-footer {
    background: var(--acv-navy);
    color: rgba(255,255,255,0.8);
    padding: 16px 0;
    font-size: 0.85rem;
    text-align: center;
    margin-top: auto;
}

.footer-times { opacity: 0.7; font-size: 0.8rem; }

/* FullCalendar overrides */
.fc { font-size: 0.9rem; }
.fc .fc-button-primary {
    background: var(--acv-navy) !important;
    border-color: var(--acv-navy) !important;
}
.fc .fc-button-primary:hover { background: var(--acv-navy-light) !important; }
.fc .fc-toolbar-title { color: var(--acv-navy); font-size: 1.1rem !important; }
.fc-event { cursor: pointer; }

/* Mobile */
@media (max-width: 768px) {
    .main-nav {
        display: none;
        position: absolute;
        top: 68px;
        left: 0;
        right: 0;
        background: #fff;
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 16px;
        z-index: 100;
        box-shadow: var(--shadow);
    }

    body.nav-open .main-nav { display: flex; }
    .nav-toggle { display: block; }
    .header-inner { position: relative; }

    .form-row { grid-template-columns: 1fr; }
    .page-header h1 { font-size: 1.25rem; }

    .data-table { font-size: 0.8rem; }
    .data-table th, .data-table td { padding: 8px 6px; }
}
