:root{
    --vermelho:#b91c1c;
    --vermelho-escuro:#7f1d1d;
    --branco:#ffffff;
    --cinza:#f4f4f5;
    --texto:#18181b;
    --preto:#0f0f10;
    --borda:#e4e4e7;
}

*{box-sizing:border-box}

body{
    margin:0;
    font-family:Arial, Helvetica, sans-serif;
    background:var(--cinza);
    color:var(--texto);
}

a{text-decoration:none;color:inherit}

.login-body{
    min-height:100vh;
    display:flex;
    align-items:center;
    justify-content:center;
    background:linear-gradient(135deg,var(--vermelho),var(--preto));
}

.login-card{
    width:390px;
    background:var(--branco);
    border-radius:22px;
    padding:32px;
    box-shadow:0 20px 60px rgba(0,0,0,.25);
}

.login-card h1{
    margin:0;
    color:var(--vermelho);
}

.login-card p{color:#71717a}

.form-group{margin-bottom:14px}

label{
    display:block;
    font-weight:700;
    margin-bottom:6px;
}

input, select, textarea{
    width:100%;
    padding:12px;
    border:1px solid var(--borda);
    border-radius:12px;
    background:#fff;
}

textarea{min-height:90px}

.btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:11px 16px;
    background:var(--vermelho);
    color:white;
    border:none;
    border-radius:12px;
    font-weight:700;
    cursor:pointer;
}

.btn:hover{background:var(--vermelho-escuro)}

.btn-light{
    background:#fff;
    color:var(--vermelho);
    border:1px solid var(--borda);
}

.layout{
    display:flex;
    min-height:100vh;
}

.sidebar{
    width:260px;
    background:var(--preto);
    color:#fff;
    padding:22px;
}

.logo{
    font-size:24px;
    font-weight:900;
    margin-bottom:26px;
    color:#fff;
}

.logo span{color:#ef4444}

.menu{
    display:flex;
    flex-direction:column;
    gap:12px;
    margin-top:-30px;
}

.menu a{
    display:flex;
    align-items:center;
    gap:14px;

    padding:14px 16px;

    border-radius:18px;

    color:#fff;
    text-decoration:none;
    font-weight:600;

    transition:.2s ease;

    background:transparent;
}

.menu a span{
    width:34px;
    height:34px;

    border-radius:12px;

    display:flex;
    align-items:center;
    justify-content:center;

    background:rgba(255,255,255,0.06);

    font-size:16px;
}

.menu a:hover{
    background:rgba(255,255,255,0.05);
    transform:translateX(4px);
}

.menu a.active{
    background:linear-gradient(
        90deg,
        rgba(220,38,38,0.22),
        transparent
    );

    border:1px solid rgba(220,38,38,0.18);
}

.content{
    flex:1;
    padding:28px;
}

.topbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin-bottom:24px;
}

.card{
    background:#fff;
    border:1px solid var(--borda);
    border-radius:20px;
    padding:22px;
    box-shadow:0 8px 25px rgba(0,0,0,.04);
}

.grid{
    display:grid;
    grid-template-columns:repeat(4,1fr);
    gap:18px;
}

.stat h2{
    margin:0;
    color:var(--vermelho);
    font-size:34px;
}

.stat p{
    margin:6px 0 0;
    color:#71717a;
}

.table{
    width:100%;
    border-collapse:collapse;
}

.table th,.table td{
    padding:13px;
    border-bottom:1px solid var(--borda);
    text-align:left;
}

.table th{
    color:#71717a;
    font-size:13px;
    text-transform:uppercase;
}

.actions{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
}

.page-title h1{
    margin:0;
}

.page-title p{
    color:#71717a;
    margin-top:5px;
}

.flash{
    padding:12px 14px;
    border-radius:12px;
    margin-bottom:14px;
    background:#fee2e2;
    color:#7f1d1d;
}

.tabs-grid{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:16px;
}

.tab-card{
    border:1px solid var(--borda);
    border-radius:18px;
    padding:18px;
    background:#fff;
}

.badge{
    padding:5px 10px;
    border-radius:999px;
    background:#fee2e2;
    color:#991b1b;
    font-size:12px;
    font-weight:700;
}

.form-grid{
    display:grid;
    grid-template-columns:repeat(2,1fr);
    gap:14px;
}

.full{grid-column:1 / -1}

@media(max-width:900px){
    .layout{display:block}
    .sidebar{width:100%}
    .grid,.tabs-grid,.form-grid{grid-template-columns:1fr}
}

.prefeituras-grid{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:20px;
    margin-top:22px;
}

.prefeitura-card{
    background:#fff;
    border:1px solid var(--borda);
    border-radius:24px;
    padding:22px;
    min-height:230px;
    display:flex;
    flex-direction:column;
    justify-content:space-between;
    box-shadow:0 10px 30px rgba(0,0,0,.05);
    transition:.2s ease;
}

.prefeitura-card:hover{
    transform:translateY(-4px);
    box-shadow:0 18px 45px rgba(185,28,28,.13);
    border-color:#fecaca;
}

.prefeitura-logo{
    width:64px;
    height:64px;
    border-radius:20px;
    background:linear-gradient(135deg,var(--vermelho),var(--vermelho-escuro));
    color:#fff;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:24px;
    font-weight:900;
    margin-bottom:16px;
}

.prefeitura-info h3{
    margin:0;
    font-size:22px;
    text-transform:uppercase;
}

.prefeitura-info p{
    margin:6px 0 0;
    color:#71717a;
}

.prefeitura-meta{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    margin:18px 0;
    color:#71717a;
    font-size:13px;
}

.prefeitura-acessar{
    font-weight:800;
    color:var(--vermelho);
}

@media(max-width:900px){
    .prefeituras-grid{
        grid-template-columns:1fr;
    }
}

.documentos-grid{
    display:grid;
    grid-template-columns:repeat(2,1fr);
    gap:18px;
}

.documento-card{
    background:#fff;
    border:1px solid var(--borda);
    border-radius:22px;
    padding:20px;
    box-shadow:0 10px 30px rgba(0,0,0,.04);
}

.documento-card h3{
    margin:14px 0 8px;
    font-size:20px;
}

.documento-card p{
    color:#52525b;
    line-height:1.5;
}

.documento-info{
    margin-top:18px;
    padding-top:14px;
    border-top:1px solid var(--borda);
    display:flex;
    flex-direction:column;
    gap:6px;
    color:#71717a;
    font-size:14px;
}

@media(max-width:900px){
    .documentos-grid{
        grid-template-columns:1fr;
    }
}

.prefeitura-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:20px;
    margin-bottom:10px;
}

.prefeitura-header-left{
    display:flex;
    align-items:center;
    gap:20px;
}

.prefeitura-logo-big{
    width:90px;
    height:90px;
    border-radius:28px;
    background:linear-gradient(135deg,var(--vermelho),var(--vermelho-escuro));
    color:#fff;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:34px;
    font-weight:900;
    box-shadow:0 15px 40px rgba(185,28,28,.25);
}

.prefeitura-header h1{
    margin:0;
    font-size:38px;
    text-transform:uppercase;
}

.prefeitura-header p{
    margin:6px 0 0;
    color:#71717a;
    font-size:16px;
}

.prefeitura-status{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
    margin-top:14px;
    color:#71717a;
    font-size:14px;
}

@media(max-width:900px){
    .prefeitura-header{
        flex-direction:column;
        align-items:flex-start;
    }

    .prefeitura-header-left{
        flex-direction:column;
        align-items:flex-start;
    }
}

.prefeitura-card > a{
    display:block;
}

.prefeitura-card .actions{
    display:flex;
    gap:10px;
    align-items:center;
}

.prefeitura-card .actions form{
    margin:0;
}

.actions form{
    margin:0;
}

@media print{
    .sidebar,
    .topbar .actions,
    .menu,
    .btn,
    form{
        display:none !important;
    }

    body{
        background:#fff;
    }

    .content{
        padding:0;
    }

    .card{
        box-shadow:none;
        border:1px solid #ddd;
        page-break-inside:avoid;
    }

    .grid{
        grid-template-columns:repeat(4,1fr);
    }
}

.timeline{
    margin-top:18px;
    display:flex;
    flex-direction:column;
    gap:16px;
}

.timeline-item{
    display:flex;
    gap:14px;
    position:relative;
}

.timeline-dot{
    width:14px;
    height:14px;
    border-radius:50%;
    background:var(--vermelho);
    margin-top:5px;
    box-shadow:0 0 0 5px #fee2e2;
}

.timeline-content{
    background:#fff5f5;
    border:1px solid #fecaca;
    border-radius:16px;
    padding:14px;
    flex:1;
}

.timeline-content p{
    margin:6px 0;
    color:#52525b;
}

.timeline-content small{
    color:#71717a;
}

.sidebar{
    width:260px;
    background:linear-gradient(180deg,#09090b,#18181b);
    color:#fff;
    padding:24px 18px;
    position:sticky;
    top:0;
    height:100vh;
    box-shadow:8px 0 35px rgba(0,0,0,.18);
    display:flex;
    flex-direction:column;
}

.sidebar-brand{
    display:flex;
    align-items:center;
    gap:12px;
    padding:8px 8px 24px;
    border-bottom:1px solid rgba(255,255,255,.08);
    margin-bottom:22px;
}

.brand-icon{
    width:46px;
    height:46px;
    border-radius:16px;
    background:linear-gradient(135deg,#dc2626,#7f1d1d);
    display:flex;
    align-items:center;
    justify-content:center;
    font-weight:900;
    box-shadow:0 14px 35px rgba(220,38,38,.3);
}

.logo{
    font-size:23px;
    font-weight:900;
    line-height:1;
}

.logo span{
    color:#ef4444;
}

.sidebar-brand small{
    color:#a1a1aa;
}

.menu{
    display:flex;
    flex-direction:column;
    gap:8px;
}

.menu a{
    display:flex;
    align-items:center;
    gap:12px;
    padding:13px 14px;
    border-radius:16px;
    color:#f4f4f5;
    font-weight:700;
    transition:.2s ease;
}

.menu a:hover{
    background:rgba(255,255,255,.08);
    transform:translateX(4px);
}

.menu a span{
    width:28px;
    height:28px;
    border-radius:10px;
    background:rgba(255,255,255,.08);
    display:flex;
    align-items:center;
    justify-content:center;
}

.sidebar-footer{
    margin-top:auto;
    padding:16px;
    border-radius:18px;
    background:linear-gradient(135deg,rgba(185,28,28,.25),rgba(255,255,255,.06));
    border:1px solid rgba(255,255,255,.08);
    display:flex;
    flex-direction:column;
    gap:4px;
}

.sidebar-footer small{
    color:#d4d4d8;
}

.user-pill{
    background:#fff;
    border:1px solid var(--borda);
    padding:10px 14px;
    border-radius:999px;
    font-weight:700;
    box-shadow:0 10px 25px rgba(0,0,0,.04);
}

.sidebar-brand-center{
    flex-direction:column;
    align-items:flex-start;
    gap:16px;
}

.big-brand{
    width:72px;
    height:72px;
    border-radius:24px;
    font-size:22px;
    font-weight:900;
}

.brand-text-center{
    display:flex;
    flex-direction:column;
    gap:6px;
}

.big-logo{
    font-size:42px;
    line-height:1;
}

.brand-text-center small{
    color:#a1a1aa;
    font-size:15px;
}

.welcome-grid{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:18px;
    margin-top:24px;
}

.welcome-card{
    background:#fff;
    border:1px solid var(--borda);
    border-radius:22px;
    padding:24px;
    box-shadow:0 14px 35px rgba(0,0,0,.06);
    display:flex;
    flex-direction:column;
    gap:8px;
}

.welcome-card strong{
    font-size:42px;
    color:var(--vermelho);
    line-height:1;
}

.welcome-card span{
    color:#71717a;
    font-weight:700;
}

@media(max-width:900px){
    .welcome-grid{
        grid-template-columns:1fr;
    }
}

.sidebar{
    width:255px;
    background:
        radial-gradient(circle at top left, rgba(185,28,28,.28), transparent 34%),
        linear-gradient(180deg,#070707,#151518);
    color:#fff;
    padding:28px 18px;
    position:sticky;
    top:0;
    height:100vh;
    box-shadow:10px 0 40px rgba(0,0,0,.22);
    display:flex;
    flex-direction:column;
}

.sidebar-brand{
    padding:4px 4px 28px;
    border-bottom:1px solid rgba(255,255,255,.08);
    margin-bottom:26px;
}

.brand-icon{
    width:76px;
    height:76px;
    border-radius:26px;
    background:linear-gradient(135deg,#ef4444,#991b1b);
    font-size:24px;
    box-shadow:0 18px 45px rgba(220,38,38,.35);
}

.logo.big-logo{
    display:none;
}

.brand-text-center small{
    font-size:16px;
    color:#d4d4d8;
    margin-top:4px;
}

.menu{
    gap:12px;
}

.menu a{
    padding:15px 14px;
    border-radius:18px;
    color:#f4f4f5;
    font-weight:800;
    letter-spacing:.1px;
    position:relative;
}

.menu a:hover{
    background:rgba(255,255,255,.09);
    transform:translateX(5px);
}

.menu a:hover::before{
    content:"";
    position:absolute;
    left:-6px;
    width:4px;
    height:28px;
    border-radius:999px;
    background:#ef4444;
}

.menu a span{
    width:34px;
    height:34px;
    border-radius:13px;
    background:rgba(255,255,255,.09);
    box-shadow:inset 0 0 0 1px rgba(255,255,255,.04);
}

.sidebar-footer{
    background:
        linear-gradient(135deg,rgba(185,28,28,.35),rgba(255,255,255,.05));
    border:1px solid rgba(255,255,255,.1);
    box-shadow:0 14px 35px rgba(0,0,0,.18);
}

.dashboard-hero{
    background:
        radial-gradient(circle at top right, rgba(185,28,28,.13), transparent 35%),
        linear-gradient(135deg,#fff,#fff8f8);
    border:1px solid #f1dada;
    border-radius:30px;
    padding:30px;
    box-shadow:0 18px 50px rgba(0,0,0,.06);
}

.dashboard-hero h1{
    font-size:40px;
    letter-spacing:-1px;
}

.welcome-card{
    position:relative;
    overflow:hidden;
    transition:.25s ease;
}

.welcome-card::after{
    content:"";
    position:absolute;
    right:-30px;
    top:-30px;
    width:100px;
    height:100px;
    border-radius:50%;
    background:rgba(185,28,28,.08);
}

.welcome-card:hover{
    transform:translateY(-4px);
    box-shadow:0 22px 50px rgba(185,28,28,.12);
}

.prefeituras-grid{
    align-items:stretch;
}

.prefeitura-card{
    position:relative;
    overflow:hidden;
    border:1px solid #f0dada;
    background:
        radial-gradient(circle at top right, rgba(185,28,28,.08), transparent 35%),
        #fff;
    min-height:260px;
}

.prefeitura-card::before{
    content:"";
    position:absolute;
    inset:0;
    border-radius:24px;
    pointer-events:none;
    box-shadow:inset 0 0 0 1px rgba(255,255,255,.8);
}

.prefeitura-card:hover{
    transform:translateY(-6px);
    box-shadow:0 24px 55px rgba(185,28,28,.16);
    border-color:#fecaca;
}

.prefeitura-logo{
    box-shadow:0 14px 35px rgba(185,28,28,.25);
}

.prefeitura-info h3{
    letter-spacing:-.5px;
}

.badge{
    background:linear-gradient(135deg,#fee2e2,#fff1f1);
    color:#991b1b;
    border:1px solid #fecaca;
    font-weight:900;
}

.prefeitura-acessar{
    font-size:16px;
    transition:.2s ease;
}

.prefeitura-card:hover .prefeitura-acessar{
    transform:translateX(4px);
}

.card{
    transition:.22s ease;
}

.card:hover{
    box-shadow:0 18px 45px rgba(0,0,0,.07);
}

.card form input{
    height:44px;
}

.btn{
    box-shadow:0 12px 25px rgba(185,28,28,.18);
    transition:.2s ease;
}

.btn:hover{
    transform:translateY(-2px);
    box-shadow:0 18px 35px rgba(185,28,28,.24);
}

.prefeitura-header{
    background:
        radial-gradient(circle at top right, rgba(185,28,28,.12), transparent 35%),
        linear-gradient(135deg,#fff,#fff8f8);
    border:1px solid #f1dada;
    border-radius:30px;
    padding:28px;
    box-shadow:0 18px 50px rgba(0,0,0,.06);
}

.prefeitura-logo-big{
    width:96px;
    height:96px;
    border-radius:30px;
    box-shadow:0 22px 55px rgba(185,28,28,.28);
}

.prefeitura-header h1{
    font-size:42px;
    letter-spacing:-1px;
}

.prefeitura-header .actions{
    background:#fff;
    border:1px solid #f1dada;
    border-radius:24px;
    padding:12px;
    box-shadow:0 15px 35px rgba(0,0,0,.05);
}

.prefeitura-header .actions .btn{
    min-height:44px;
}

.stat{
    position:relative;
    overflow:hidden;
}

.stat::after{
    content:"";
    position:absolute;
    right:-24px;
    top:-24px;
    width:86px;
    height:86px;
    border-radius:50%;
    background:rgba(185,28,28,.08);
}

.stat h2{
    font-size:38px;
}

.form-grid input,
.form-grid select,
.form-grid textarea{
    border-radius:16px;
    border-color:#e4e4e7;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus{
    outline:none;
    border-color:#ef4444;
    box-shadow:0 0 0 4px rgba(239,68,68,.12);
}

.card h3{
    font-size:22px;
    letter-spacing:-.3px;
}

.card .btn{
    padding:13px 20px;
    border-radius:14px;
}

.prefeitura-header{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:30px;
    flex-wrap:wrap;
}

.prefeitura-header-left{
    display:flex;
    align-items:center;
    gap:22px;
    flex:1;
    min-width:320px;
}

.prefeitura-header-right{
    background:#fff;
    border:1px solid #f1dada;
    border-radius:26px;
    padding:16px;
    box-shadow:0 18px 40px rgba(0,0,0,.06);

    display:flex;
    align-items:center;
    gap:14px;
    flex-wrap:wrap;
}

.prefeitura-header-right .btn{
    min-width:170px;
    justify-content:center;
    display:flex;
    align-items:center;
}

.prefeitura-header-right .btn-light{
    background:#fff;
}

.prefeitura-header-info{
    display:flex;
    flex-direction:column;
    gap:10px;
}

.prefeitura-header-meta{
    display:flex;
    align-items:center;
    gap:16px;
    flex-wrap:wrap;
}

.badge-pago{
    background:#dcfce7 !important;
    color:#166534 !important;
    border:1px solid #86efac !important;
}

.badge-pendente{
    background:#fee2e2 !important;
    color:#b91c1c !important;
    border:1px solid #fecaca !important;
}

.badge-vencido{
    background:#7f1d1d !important;
    color:#ffffff !important;
    border:1px solid #991b1b !important;
}

.badge-pago{
    background:#dcfce7 !important;
    color:#166534 !important;
    border:1px solid #86efac !important;
}

.badge-pendente{
    background:#fee2e2 !important;
    color:#b91c1c !important;
    border:1px solid #fecaca !important;
}

.badge-vencido{
    background:#7f1d1d !important;
    color:#ffffff !important;
    border:1px solid #991b1b !important;
}

.upload-box{
    width:100%;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:12px;
    border:1px dashed rgba(220,38,38,0.35);
    border-radius:14px;
    background:#fff;
    cursor:pointer;
    transition:.2s;
    font-weight:600;
    color:#991b1b;
}

.upload-box:hover{
    background:#fef2f2;
    border-color:#dc2626;
}

.sidebar{
    overflow-y:auto;
}

.sidebar-brand{
    margin-bottom:14px !important;
    padding-bottom:18px !important;
}

.menu{
    gap:6px !important;
    margin-top:8px !important;
}

.menu a{
    padding:11px 14px !important;
    font-size:15px;
}

.menu a span{
    width:30px !important;
    height:30px !important;
}

.sidebar-footer{
    margin-top:18px !important;
    padding:12px !important;
}

.chart-card{
    position:relative;
    overflow:hidden;
}

.chart-card::before{
    content:"";
    position:absolute;
    right:-70px;
    top:-70px;
    width:180px;
    height:180px;
    border-radius:50%;
    background:rgba(185,28,28,.08);
}