@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --brand-green: #00965e;
    --brand-dark: #07272d;
    --brand-neutral: #e5e1e6;
    --brand-black: #232222;
}

body {
    background: #f7f9f7;
    color: var(--brand-black);
    font-family: Inter, Arial, sans-serif;
}

.navbar {
    box-shadow: none;
}

.site-version {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--brand-neutral);
    border-radius: 0.4rem;
    bottom: 0.75rem;
    color: #5b686b;
    font-size: 0.72rem;
    padding: 0.3rem 0.55rem;
    pointer-events: none;
    position: fixed;
    right: 0.75rem;
    z-index: 1020;
}

.brand-navbar {
    background: #fff;
    border-bottom: 1px solid var(--brand-neutral);
    min-height: 76px;
    padding: 0.6rem 1rem;
}

.brand-link {
    align-items: center;
    display: flex;
    gap: 1rem;
    text-decoration: none;
}

.brand-logo {
    display: block;
    height: auto;
    max-height: 54px;
    width: 178px;
}

.brand-app-name {
    border-left: 1px solid var(--brand-neutral);
    color: var(--brand-dark);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    padding-left: 1rem;
}

.btn {
    border-radius: 0.45rem;
    box-shadow: none !important;
    font-weight: 500;
}

.btn:not(.btn-sm) {
    padding: 0.4rem 0.75rem;
}

.btn-sm {
    padding: 0.25rem 0.55rem;
}

.navbar-toggler {
    border: 0;
    color: var(--brand-dark);
    padding: 0.35rem;
}

.btn-primary,
.btn-success {
    --bs-btn-bg: var(--brand-green);
    --bs-btn-border-color: var(--brand-green);
    --bs-btn-hover-bg: #007a4d;
    --bs-btn-hover-border-color: #007a4d;
    --bs-btn-active-bg: #006a43;
    --bs-btn-active-border-color: #006a43;
}

.btn-outline-primary,
.btn-outline-success {
    --bs-btn-color: var(--brand-green);
    --bs-btn-border-color: var(--brand-green);
    --bs-btn-hover-bg: var(--brand-green);
    --bs-btn-hover-border-color: var(--brand-green);
    --bs-btn-active-bg: #007a4d;
    --bs-btn-active-border-color: #007a4d;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-green);
    box-shadow: 0 0 0 0.2rem rgba(0, 150, 94, 0.18);
}

.table-striped > tbody > tr.has-branches > * {
    --bs-table-bg: #e8f5e9;
    --bs-table-bg-type: #e8f5e9;
    --bs-table-striped-bg: #e8f5e9;
    --bs-table-striped-bg-type: #e8f5e9;
}

.sidebar-menu {
    --bs-offcanvas-width: 290px;
    background-color: var(--brand-dark) !important;
}

.sidebar-nav .nav-link {
    border-radius: 0.5rem;
    color: #e5e1e6;
    padding: 0.75rem 1rem;
}

.sidebar-nav-item,
.sidebar-nav-toggle {
    align-items: center;
    display: flex;
    gap: 0.8rem;
}

.sidebar-nav-toggle {
    justify-content: space-between;
    text-align: left;
    width: 100%;
}

.sidebar-nav .sidebar-icon {
    fill: none;
    flex: 0 0 1.2rem;
    height: 1.2rem;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
    width: 1.2rem;
}

.sidebar-subnav {
    border-left: 1px solid rgba(229, 225, 230, 0.22);
    margin: 0.15rem 0 0.45rem 1.15rem;
    padding-left: 0.55rem;
}

.sidebar-subnav .nav-link {
    font-size: 0.92rem;
    padding: 0.65rem 0.75rem;
}

.sidebar-nav .nav-link.active,
.sidebar-nav .sidebar-nav-toggle[aria-expanded="true"] {
    background: rgba(0, 150, 94, 0.2);
    color: #fff;
}

.sidebar-chevron {
    transition: transform 0.2s ease;
}

.sidebar-nav-toggle[aria-expanded="true"] .sidebar-chevron {
    transform: rotate(180deg);
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link:focus {
    background: rgba(0, 150, 94, 0.2);
    color: #fff;
}

.offcanvas-header {
    border-bottom: 1px solid rgba(229, 225, 230, 0.18);
}

.card {
    border-color: var(--brand-neutral);
    border-radius: 0.85rem;
}

.card-header {
    background: #fff;
    border-bottom-color: var(--brand-neutral);
}

.table {
    --bs-table-border-color: var(--brand-neutral);
}

.table thead th {
    background: #f1f5f2;
    color: var(--brand-dark);
    font-weight: 600;
    white-space: nowrap;
}

.problem-summary {
    max-width: 420px;
    white-space: normal;
}

.status-summary {
    max-width: 320px;
    white-space: normal;
}

.detail-text {
    white-space: pre-wrap;
}

.status-timeline {
    list-style: none;
    margin: 0;
    padding: 0 0 0 1rem;
}

.status-timeline-item {
    border-left: 1px solid #dbe1ea;
    display: grid;
    gap: 0.45rem;
    padding: 0 0 1.25rem 1.25rem;
    position: relative;
}

.status-timeline-item::before {
    background: #64748b;
    border: 2px solid #fff;
    border-radius: 50%;
    content: "";
    height: 0.75rem;
    left: -0.4rem;
    position: absolute;
    top: 0.15rem;
    width: 0.75rem;
}

.status-timeline-item:last-child {
    border-left-color: transparent;
    padding-bottom: 0;
}

.status-timeline-item time {
    color: #64748b;
    font-size: 0.85rem;
}

.status-timeline-item .badge {
    justify-self: start;
}

.page-title {
    color: var(--brand-dark);
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
}

.stat-card {
    border-radius: 18px;
    padding: 1.5rem;
    color: white;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 10px 20px rgba(26, 35, 50, 0.08);
}

.stat-card.status-open { background: linear-gradient(135deg, #00965e, #007a4d); }
.stat-card.status-progress { background: linear-gradient(135deg, #00965e, #007a4d); }
.stat-card.status-finished { background: linear-gradient(135deg, #07272d, #0d3d44); }
.stat-card.risk-low { background: #7dd3fc; color: #0c4a6e; }
.stat-card.risk-medium { background: #facc15; color: #713f12; }
.stat-card.risk-high { background: #ef4444; color: white; }

.stat-card span {
    font-size: 0.8rem;
    letter-spacing: 0.04rem;
    text-transform: uppercase;
    opacity: 0.9;
}

.stat-card strong {
    font-size: 2rem;
    margin-top: 0.5rem;
}

.map-card {
    overflow: hidden;
    border-radius: 18px;
    box-shadow: 0 10px 24px rgba(7, 39, 45, 0.08);
}

.map-card .card-header {
    align-items: center;
    border-bottom: 1px solid var(--brand-neutral);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: space-between;
    padding: 1rem 1.25rem;
}

.map-card .card-header h2 {
    color: var(--brand-dark);
    font-size: 1.15rem;
    margin: 0;
}

#map {
    height: 500px;
    width: 100%;
}

.selection-map {
    height: 430px;
    width: 100%;
    border-radius: 0 0 0.375rem 0.375rem;
}

.map-pin {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 2px solid #fff;
    border-radius: 50% 50% 50% 0;
    color: #fff;
    font-size: 19px;
    transform: rotate(-45deg);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    margin-bottom: 8px;
    flex: 0 0 36px;
}

.map-marker-wrapper {
    align-items: center;
    display: flex;
    flex-direction: column;
    height: 80px;
    justify-content: flex-end;
    width: 94px;
}

.map-priority-badges {
    align-items: center;
    display: flex;
    gap: 3px;
    justify-content: center;
}

.map-priority-badge {
    align-items: center;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    display: inline-flex;
    font-size: 10px;
    font-weight: 700;
    height: 24px;
    justify-content: center;
    line-height: 1;
    min-width: 24px;
    padding: 0 3px;
}

.map-priority-badge.medium { background: #facc15; color: #713f12; }
.map-priority-badge.high { background: #ef4444; color: #fff; }
.map-priority-badge.low { background: #7dd3fc; color: #0c4a6e; }

.map-pin > span {
    transform: rotate(45deg);
}

.map-pin.yellow { background: #eab308; }
.map-pin.purple { background: #7e22ce; }
.map-pin.orange { background: #f97316; }
.map-pin.green { background: #16a34a; }
.map-pin-icons {
    display: flex;
    align-items: center;
    gap: 0;
    font-size: 15px;
}
.map-pin-icons span { transform: none; }

.legend {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: #4b5563;
}

.dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 0.3rem;
}

.dot.yellow { background: #eab308; }
.dot.purple { background: #7e22ce; }
.dot.orange { background: #f97316; }
.dot.green { background: #16a34a; }

.local-popup {
    min-width: 240px;
}

.local-popup-title {
    display: block;
    font-size: 1rem;
}

.local-popup-summary {
    color: #64748b;
    font-size: 0.8rem;
    margin: 0.15rem 0 0.5rem;
}

.local-popup-bubbles {
    display: grid;
    gap: 0.4rem;
    max-height: 260px;
    overflow-y: auto;
}

.pendencia-bubble {
    border-left: 4px solid;
    border-radius: 0.5rem;
    display: grid;
    gap: 0.1rem;
    padding: 0.45rem 0.6rem;
}

.pendencia-bubble-priority {
    font-size: 0.65rem;
    font-weight: 700;
}

.pendencia-bubble small {
    color: #475569;
}

.pendencia-bubble.risk-high {
    background: #fee2e2;
    border-color: #ef4444;
}

.pendencia-bubble.risk-medium {
    background: #fef3c7;
    border-color: #f59e0b;
}

.pendencia-bubble.risk-low {
    background: #e0f2fe;
    border-color: #38bdf8;
}

.local-popup-more {
    display: inline-block;
    font-weight: 600;
    margin-top: 0.6rem;
}

@media (max-width: 575.98px) {
    .brand-navbar {
        min-height: 66px;
        padding: 0.5rem 0.75rem;
    }

    .brand-link {
        gap: 0.6rem;
    }

    .brand-logo {
        max-height: 44px;
        width: 145px;
    }

    .brand-app-name {
        display: none;
    }
}
