:root {
    --primary: #1e3a5f;
    --primary-dark: #152a45;
    --sidebar-width: 260px;
    --topbar-height: 60px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f0f2f5;
    margin: 0;
}

/* Auth */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 1rem;
}

.auth-container { width: 100%; max-width: 420px; }
.auth-card {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0,0,0,.2);
}

/* Layout */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--primary);
    color: #fff;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1000;
    transition: transform .3s ease;
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    border-bottom: 1px solid rgba(255,255,255,.1);
    font-weight: 600;
}

.sidebar-nav { padding: 1rem 0; }

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1.25rem;
    color: rgba(255,255,255,.8);
    text-decoration: none;
    transition: all .2s;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    background: rgba(255,255,255,.1);
    color: #fff;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-height);
    background: var(--primary-dark);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar-title { flex: 1; font-weight: 600; margin-left: .5rem; }
.topbar-actions { display: flex; align-items: center; }
.user-info { font-size: .9rem; }

.content-area { padding: 1.5rem; flex: 1; }

.sidebar-toggle {
    color: #fff !important;
    padding: 0;
}

/* Stats */
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    border-left: 4px solid;
}

.stat-primary { border-color: #0d6efd; }
.stat-info { border-color: #0dcaf0; }
.stat-warning { border-color: #ffc107; }
.stat-success { border-color: #198754; }
.stat-danger { border-color: #dc3545; }

.stat-icon { font-size: 1.5rem; opacity: .7; }
.stat-value { font-size: 2rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: .85rem; color: #6c757d; }

/* Timeline */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
    content: '';
    position: absolute;
    left: .5rem;
    top: 0; bottom: 0;
    width: 2px;
    background: #dee2e6;
}

.timeline-item { position: relative; padding-bottom: 1.5rem; }
.timeline-marker {
    position: absolute;
    left: -1.65rem;
    top: .25rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--primary);
}

.timeline-content {
    background: #f8f9fa;
    padding: .75rem 1rem;
    border-radius: 8px;
}

/* Mobile */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .topbar-actions .user-info { display: none; }
}

@media (max-width: 575.98px) {
    .content-area { padding: 1rem; }
    .stat-value { font-size: 1.5rem; }
}

.sidebar-collapsed .sidebar { transform: translateX(-100%); }
.sidebar-collapsed .main-content { margin-left: 0; }

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.card { border: none; border-radius: 10px; }

.nav-section .nav-link.sub {
    padding-left: 2.5rem;
    font-size: .9rem;
}

.nav-toggle { cursor: pointer; }

.portal-body { background: #f8f9fa; min-height: 100vh; }
.portal-card { transition: transform .2s; border: none; }
.portal-card:hover { transform: translateY(-4px); }
.portal-footer { background: #fff; border-top: 1px solid #dee2e6; }
.portal-cidadao-body { background: #f0f4f8; padding-bottom: 80px; }
.bottom-nav { z-index: 1030; }
.equipe-pwa-body { background: #f8f9fa; min-height: 100vh; }
.equipe-header { position: sticky; top: 0; z-index: 100; }

/* Anexos e galeria */
.anexos-gallery { display: grid; gap: 1rem; }
@media (min-width: 576px) { .anexos-gallery { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 992px) { .anexos-gallery { grid-template-columns: repeat(3, 1fr); } }
.anexo-item {
    border: 1px solid #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}
.anexo-thumb { display: block; aspect-ratio: 4/3; overflow: hidden; background: #f1f3f5; }
.anexo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.anexo-doc-icon { display: flex; align-items: center; justify-content: center; aspect-ratio: 4/3; background: #f8f9fa; }
.anexo-meta { padding: .75rem; }
.anexo-nome { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* PWA Equipe — fotos de campo */
.os-camera-zone {
    border: 2px dashed #198754;
    border-radius: 12px;
    padding: 2rem 1rem;
    text-align: center;
    background: #f8fff9;
    cursor: pointer;
}
.os-foto-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; }
.os-foto-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.os-foto-caption { padding: .35rem .25rem; font-size: .75rem; }
.os-foto-card .form-text { font-size: .8rem; }
