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

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.hidden {
    display: none !important;
}

/* Navbar */
nav {
    background: linear-gradient(135deg, #066aab 0%, #044a7a 100%);
    color: white;
    padding: 0 2rem;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 2rem;
    box-shadow: 0 2px 8px rgba(6, 106, 171, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-brand img {
    height: 32px;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
    flex: 1;
}

.nav-links a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-links a:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

/* Pages */
.page {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    animation: fadeIn 0.3s ease;
}

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

h1 {
    margin-bottom: 1.5rem;
    color: #066aab;
    font-weight: 700;
    font-size: 1.75rem;
}

h2 {
    margin-bottom: 1rem;
    color: #1a365d;
    font-weight: 600;
}

/* Login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #066aab 0%, #044a7a 50%, #032d4e 100%);
    padding: 1rem;
}

.login-card {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 420px;
}

.login-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-logo img {
    max-width: 200px;
    height: auto;
}

.login-card h1 {
    text-align: center;
    color: #066aab;
    margin-bottom: 0.25rem;
    font-size: 1.5rem;
}

.login-card h2 {
    text-align: center;
    color: #64748b;
    margin-bottom: 2rem;
    font-weight: 400;
    font-size: 0.95rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s;
    background: #f8fafc;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #066aab;
    box-shadow: 0 0 0 3px rgba(6, 106, 171, 0.15);
    background: white;
}

.filter-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fb;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.filter-row .form-group {
    flex: 1;
    min-width: 150px;
}

.filter-row .btn {
    white-space: nowrap;
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

.form-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #066aab 0%, #044a7a 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(6, 106, 171, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #055a95 0%, #033d66 100%);
    box-shadow: 0 4px 12px rgba(6, 106, 171, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #e2e8f0;
    color: #475569;
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-success {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    text-align: center;
    border-left: 4px solid #066aab;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-number {
    font-size: 2.25rem;
    font-weight: 700;
    color: #066aab;
}

.stat-label {
    color: #64748b;
    margin-top: 0.25rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.stat-pending { border-left-color: #f59e0b; }
.stat-pending .stat-number { color: #f59e0b; }
.stat-approved { border-left-color: #059669; }
.stat-approved .stat-number { color: #059669; }
.stat-rejected { border-left-color: #dc2626; }
.stat-rejected .stat-number { color: #dc2626; }

/* Section */
.section {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 1.5rem;
}

/* Checklist Table */
.checklist-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.checklist-table th,
.checklist-table td {
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    text-align: left;
}

.checklist-table th {
    background: #f1f5f9;
    font-weight: 600;
    color: #1e40af;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.checklist-table input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #066aab;
}

.checklist-table input[type="text"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.85rem;
}

.status-yes { background: #d1fae5; text-align: center; font-weight: 500; }
.status-no { background: #fee2e2; text-align: center; font-weight: 600; color: #991b1b; }
.status-na { background: #fef3c7; text-align: center; }

/* Cards */
.checklist-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #e2e8f0;
}

.checklist-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
}

.card-plate {
    font-weight: 700;
    font-size: 1.05rem;
    color: #066aab;
}

.card-status {
    padding: 0.3rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
}

.card-status.status-pendente { background: #fef3c7; color: #92400e; }
.card-status.status-aprovado { background: #d1fae5; color: #065f46; }
.card-status.status-rejeitado { background: #fee2e2; color: #991b1b; }

.card-body {
    padding: 1rem 1.25rem;
    color: #475569;
    font-size: 0.9rem;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
}

.data-table th {
    background: #f1f5f9;
    font-weight: 600;
    color: #1e40af;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tr:hover {
    background: #f8fafc;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-content h3 {
    margin-bottom: 1.5rem;
    color: #066aab;
    font-weight: 700;
}

/* Detail */
.detail-header {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.detail-notes {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-top: 1.5rem;
}

/* Canvas */
canvas {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: crosshair;
    display: block;
    background: white;
}

/* Photo preview */
.photo-preview {
    margin-top: 0.5rem;
}

.photo-preview img {
    border-radius: 8px;
    border: 2px solid #e2e8f0;
}

/* Error */
.error-msg {
    color: #dc2626;
    margin-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
}

.cal-legend { display:flex; gap:1rem; flex-wrap:wrap; margin:0.75rem 0; font-size:0.85rem; color:#475569; }
.cal-legend span { display:flex; align-items:center; gap:6px; }
.cal-dot { width:12px; height:12px; border-radius:50%; display:inline-block; border:1px solid #e2e8f0; }
.cal-dot.cal-ok { background:#22c55e; }
.cal-dot.cal-pend { background:#facc15; }
.cal-dot.cal-miss { background:#ef4444; }
.cal-dot.cal-rej { background:#dc2626; }
.cal-summary { display:flex; gap:0.75rem; flex-wrap:wrap; margin-bottom:0.75rem; font-size:0.85rem; }
.cal-summary span { background:#f8fafc; border:1px solid #e2e8f0; border-radius:20px; padding:4px 10px; }
.cal-grid { display:grid; grid-template-columns: repeat(7, 1fr); gap:6px; }
.cal-head { text-align:center; font-weight:600; font-size:0.8rem; color:#64748b; padding:6px 0; }
.cal-day { aspect-ratio:1; border-radius:10px; border:1px solid #e2e8f0; display:flex; flex-direction:column; align-items:center; justify-content:center; font-size:0.9rem; background:#fff; cursor:pointer; transition: transform .1s; }
.cal-day:hover { transform: scale(1.03); }
.cal-day.cal-ok { background:#dcfce7; border-color:#86efac; color:#14532d; }
.cal-day.cal-pend { background:#fef9c3; border-color:#fde68a; color:#713f12; }
.cal-day.cal-miss { background:#fee2e2; border-color:#fecaca; color:#7f1d1d; }
.cal-day.cal-rej { background:#fecaca; border-color:#fca5a5; color:#7f1d1d; }
.cal-day.cal-empty { background:transparent; border:none; cursor:default; }
.cal-day.cal-future { opacity:0.45; }
.cal-day small { font-size:0.65rem; margin-top:2px; }

.nav-toggle { display:none; flex-direction:column; justify-content:center; gap:5px; width:40px; height:40px; background:rgba(255,255,255,0.15); border:none; border-radius:8px; cursor:pointer; padding:8px; }
.nav-toggle span { display:block; height:2px; background:#fff; border-radius:2px; transition: all .25s; }
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity:0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Responsive */
@media (max-width: 900px) {
    nav { padding: 0 1rem; gap: 0.75rem; height:56px; }
    .nav-toggle { display:flex; }
    .nav-links {
        position: fixed;
        top:56px; left:0; right:0;
        background: linear-gradient(135deg, #066aab 0%, #044a7a 100%);
        flex-direction: column;
        padding: 0.75rem 1rem 1rem;
        gap:0;
        max-height: calc(100dvh - 56px);
        overflow-y:auto;
        transform: translateY(-8px);
        opacity:0; pointer-events:none;
        transition: all .2s ease;
        box-shadow: 0 8px 20px rgba(0,0,0,0.2);
        flex:none;
    }
    .nav-links.open { transform: translateY(0); opacity:1; pointer-events:auto; }
    .nav-links a { padding:0.9rem 1rem; border-radius:8px; }
    .nav-user { margin-left:auto; }
    .nav-user #user-name { display:none; }
    .form-row { flex-direction: column; }
    .page { padding: 1rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .login-card { padding: 1.5rem; }
    .filter-row { padding:0.75rem; }
    .cal-grid { gap:4px; }
    .checklist-table { display:block; overflow-x:auto; white-space:nowrap; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}

/* ---- Offline / status de conexao ---- */
.net-status {
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 9999px;
    cursor: pointer;
    line-height: 1.2;
    white-space: nowrap;
    font-family: inherit;
}
.net-status:hover { background: rgba(255, 255, 255, 0.24); }
.net-status.has-pending { background: #f59e0b; border-color: #f59e0b; color: #1f2937; }
.net-status.is-offline { background: #dc2626; border-color: #dc2626; color: #fff; }

.offline-banner {
    background: #fef3c7;
    color: #92400e;
    border-bottom: 1px solid #fcd34d;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
}

.pending-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    margin-bottom: 8px;
}
.pending-error { color: #dc2626; font-size: 0.78rem; margin-top: 2px; }
.muted { color: #64748b; font-size: 0.85rem; }

.app-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translate(-50%, 24px);
    background: #1e293b;
    color: #fff;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 0.9rem;
    max-width: min(92vw, 520px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s ease;
    z-index: 5000;
}
.app-toast.show { opacity: 1; transform: translate(-50%, 0); }
.app-toast-success { background: #059669; }
.app-toast-warn { background: #d97706; }
.app-toast-error { background: #dc2626; }

/* ---- Rastreamento ---- */
.tracking-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
}
.tracking-toolbar .form-group { margin: 0; }
.tracking-auto {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 400;
    cursor: pointer;
    font-size: 0.9rem;
}
.tracking-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 16px;
    align-items: start;
}
.tracking-map {
    width: 100%;
    height: 520px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #eef2f7;
    z-index: 1;
}
.tracking-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    max-height: 520px;
    overflow: auto;
}
.tracking-panel h2 { margin-top: 0; font-size: 1rem; }
.tracking-list { display: flex; flex-direction: column; gap: 8px; }
.tracking-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
}
.tracking-item:hover { background: #f8fafc; }
.tracking-item.active { border-color: #066aab; box-shadow: 0 0 0 2px rgba(6, 106, 171, 0.15); }
.tracking-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex: none; }

@media (max-width: 900px) {
    .tracking-layout { grid-template-columns: 1fr; }
    .tracking-map { height: 380px; }
    .tracking-panel { max-height: none; }
}
