:root{
    --bg:#1d2129;
    --bg-soft:#2a2f39;
    --card:rgba(235,238,244,.86);
    --card-solid:#e7ebf1;
    --text:#101828;
    --muted:#54606f;
    --line:rgba(15,23,42,.10);
    --shadow:0 18px 50px rgba(15,23,42,.14);
    --shadow-soft:0 10px 30px rgba(15,23,42,.10);
    --primary:#6d5efc;
    --primary-2:#22c7ff;
    --success:#18b873;
    --warning:#f59e0b;
    --danger:#ef4444;
    --blue:#06b6d4;
    --purple:#8b5cf6;
    --glass-blur:18px;
}

html[data-theme="dark"]{
    --bg:#09090f;
    --bg-soft:#12131d;
    --card:rgba(17,24,39,.74);
    --card-solid:#121826;
    --text:#eef2ff;
    --muted:#9aa4b2;
    --line:rgba(255,255,255,.08);
    --shadow:0 18px 50px rgba(0,0,0,.38);
    --shadow-soft:0 10px 30px rgba(0,0,0,.30);
    --primary:#8b7cff;
    --primary-2:#22c7ff;
    --success:#22c55e;
    --warning:#fbbf24;
    --danger:#fb7185;
    --blue:#38bdf8;
    --purple:#a78bfa;
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
    font-family:Inter,Arial,Helvetica,sans-serif;
    background:
        radial-gradient(circle at top left, rgba(109,94,252,.22), transparent 28%),
        radial-gradient(circle at bottom right, rgba(34,199,255,.18), transparent 24%),
        linear-gradient(135deg, rgba(6,10,18,1) 0%, rgba(20,24,34,1) 36%, rgba(32,16,58,1) 100%);
    color:var(--text);
    min-height:100vh;
    overflow-x:hidden;
}
html[data-theme="light"] body{
    background:
        radial-gradient(circle at top left, rgba(109,94,252,.12), transparent 28%),
        radial-gradient(circle at bottom right, rgba(34,199,255,.10), transparent 24%),
        linear-gradient(135deg, #b9c1cb 0%, #d0d6df 100%);
}
a{text-decoration:none;color:inherit}

.bg-orb{
    position:fixed;
    border-radius:50%;
    filter:blur(80px);
    opacity:.45;
    z-index:0;
    pointer-events:none;
}
.orb-1{width:260px;height:260px;top:-60px;left:-60px;background:#7c3aed}
.orb-2{width:260px;height:260px;top:18%;right:-80px;background:#06b6d4}
.orb-3{width:300px;height:300px;bottom:-120px;left:30%;background:#22c55e}

.app-shell{
    display:flex;
    min-height:100vh;
    position:relative;
    z-index:1;
}

.sidebar{
    width:300px;
    margin:18px;
    padding:20px;
    border:1px solid var(--line);
    border-radius:30px;
    color:var(--text);
    display:flex;
    flex-direction:column;
    gap:24px;
    box-shadow:var(--shadow);
}

.glass{
    background:var(--card);
    backdrop-filter:blur(var(--glass-blur));
    -webkit-backdrop-filter:blur(var(--glass-blur));
}
.glass-soft{
    background:rgba(255,255,255,.06);
    border:1px solid var(--line);
    box-shadow:var(--shadow-soft);
}
html[data-theme="light"] .glass-soft{
    background:rgba(255,255,255,.44);
}

.brand-wrap{
    display:flex;
    align-items:center;
    gap:14px;
}
.premium-brand{
    padding:14px 14px 16px;
    border-radius:24px;
    background:linear-gradient(135deg, rgba(109,94,252,.12), rgba(34,199,255,.08));
    border:1px solid rgba(255,255,255,.10);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.10),
        0 10px 30px rgba(109,94,252,.12);
}

.brand-icon-svg{
    width:70px;
    height:70px;
    min-width:70px;
    border-radius:22px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:
        radial-gradient(circle at top left, rgba(255,255,255,.35), rgba(255,255,255,.06)),
        linear-gradient(135deg, rgba(109,94,252,.22), rgba(6,182,212,.18));
    border:1px solid rgba(255,255,255,.16);
    box-shadow:
        0 18px 34px rgba(109,94,252,.24),
        inset 0 1px 0 rgba(255,255,255,.18);
    overflow:hidden;
    position:relative;
}
.brand-icon-svg::before{
    content:"";
    position:absolute;
    inset:0;
    background:linear-gradient(135deg, rgba(255,255,255,.18), transparent 48%);
    pointer-events:none;
}
.brand-icon-svg svg{
    width:52px;
    height:52px;
    display:block;
    filter:drop-shadow(0 8px 14px rgba(0,0,0,.18));
    position:relative;
    z-index:1;
}

.brand-texts{
    min-width:0;
}
.brand{
    font-size:22px;
    font-weight:900;
    letter-spacing:-.02em;
    line-height:1.05;
}
.brand-sub{
    margin-top:4px;
    font-size:12px;
    color:var(--muted);
    text-transform:lowercase;
}

.menu{
    display:flex;
    flex-direction:column;
    gap:10px;
}
.menu a{
    padding:14px 16px;
    border-radius:16px;
    border:1px solid transparent;
    transition:.25s ease;
    color:var(--muted);
    font-weight:700;
}
.menu a:hover,
.menu a.active{
    color:var(--text);
    background:linear-gradient(135deg, rgba(109,94,252,.18), rgba(59,130,246,.14));
    border-color:var(--line);
    transform:translateX(3px);
}

.sidebar-user{
    margin-top:auto;
    padding:14px;
    border-radius:20px;
    display:flex;
    align-items:center;
    gap:12px;
}
.avatar-circle{
    width:44px;
    height:44px;
    border-radius:50%;
    display:flex;
    align-items:center;
    justify-content:center;
    background:linear-gradient(135deg,var(--primary),var(--blue));
    color:#fff;
    font-weight:800;
}
.role-pill{
    display:inline-block;
    margin-top:4px;
    font-size:12px;
    color:var(--muted);
}

.main-content{
    flex:1;
    padding:22px 22px 32px 0;
}
.top-utility{
    display:flex;
    justify-content:flex-end;
    margin-bottom:14px;
}
.theme-toggle{
    border:none;
    padding:12px 16px;
    border-radius:16px;
    background:var(--card);
    color:var(--text);
    backdrop-filter:blur(16px);
    border:1px solid var(--line);
    box-shadow:var(--shadow-soft);
    display:flex;
    gap:10px;
    align-items:center;
    cursor:pointer;
    transition:.25s ease;
}
.theme-toggle:hover{
    transform:translateY(-2px);
}

.page{
    display:flex;
    flex-direction:column;
    gap:20px;
}
.hero-panel{
    border-radius:28px;
    border:1px solid var(--line);
    padding:28px;
    box-shadow:var(--shadow);
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:18px;
}
.hero-panel h1{
    margin:6px 0 8px;
    font-size:34px;
    line-height:1.05;
}
.hero-panel p{
    margin:0;
    color:var(--muted);
    max-width:720px;
}
.eyebrow{
    display:inline-block;
    font-size:12px;
    text-transform:uppercase;
    letter-spacing:.12em;
    font-weight:800;
    color:var(--primary);
}
.hero-actions,.actions,.filter-actions,.form-actions{
    display:flex;
    flex-wrap:wrap;
    gap:10px;
}

.card{
    border-radius:24px;
    border:1px solid var(--line);
    padding:22px;
    box-shadow:var(--shadow-soft);
}
.card h3{
    margin-top:0;
}

.topbar{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
}
.topbar.fancy h1{
    margin:6px 0 0;
    font-size:30px;
}

label{
    display:block;
    font-size:14px;
    font-weight:700;
    margin-bottom:8px;
    color:var(--text);
}
input,select,textarea{
    width:100%;
    padding:13px 14px;
    border-radius:16px;
    border:1px solid var(--line);
    background:rgba(255,255,255,.08);
    color:var(--text);
    outline:none;
    transition:.2s ease;
    margin-bottom:14px;
}
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea{
    background:rgba(255,255,255,.54);
}
input:focus,select:focus,textarea:focus{
    border-color:rgba(109,94,252,.50);
    box-shadow:0 0 0 4px rgba(109,94,252,.12);
}
button{cursor:pointer}

.btn{
    border:none;
    padding:11px 16px;
    border-radius:16px;
    background:#e5e7eb;
    color:#111827;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    font-weight:700;
    transition:.2s ease;
}
.btn:hover{transform:translateY(-2px)}
.btn.primary{
    color:#fff;
    background:linear-gradient(135deg,var(--primary),var(--primary-2));
}
.btn.success{background:linear-gradient(135deg,#16a34a,#22c55e);color:#fff}
.btn.warning{background:linear-gradient(135deg,#d97706,#f59e0b);color:#fff}
.btn.danger{background:linear-gradient(135deg,#dc2626,#fb7185);color:#fff}
.btn.ghost{
    background:transparent;
    color:var(--text);
    border:1px solid var(--line);
}
.btn.small{
    padding:8px 11px;
    font-size:12px;
    border-radius:12px;
}
.glow{
    box-shadow:0 14px 30px rgba(109,94,252,.28);
}

.grid{display:grid;gap:16px}
.grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.grid-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.grid-4{grid-template-columns:repeat(4,minmax(0,1fr))}
.grid-6{grid-template-columns:repeat(6,minmax(0,1fr))}
.full{grid-column:1/-1}

.cards-grid{
    display:grid;
    grid-template-columns:repeat(5,minmax(0,1fr));
    gap:16px;
}
.stat-card{
    padding:22px;
    border-radius:24px;
    color:#fff;
    box-shadow:var(--shadow);
    min-height:132px;
    display:flex;
    flex-direction:column;
    justify-content:space-between;
    position:relative;
    overflow:hidden;
}
.stat-card::after{
    content:"";
    position:absolute;
    width:110px;
    height:110px;
    border-radius:50%;
    background:rgba(255,255,255,.12);
    right:-20px;
    top:-20px;
}
.stat-card span{
    font-size:14px;
    opacity:.92;
}
.stat-card strong{
    font-size:28px;
    line-height:1.1;
}
.gradient-card.purple{background:linear-gradient(135deg,#7c3aed,#5b5df0)}
.gradient-card.green{background:linear-gradient(135deg,#10b981,#22c55e)}
.gradient-card.amber{background:linear-gradient(135deg,#f59e0b,#fbbf24)}
.gradient-card.red{background:linear-gradient(135deg,#ef4444,#fb7185)}
.gradient-card.blue{background:linear-gradient(135deg,#06b6d4,#3b82f6)}

.charts-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:16px;
}
.chart-card{
    min-height:360px;
}
.chart-title-wrap{
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:10px;
    margin-bottom:14px;
}
.chart-title-wrap span{
    color:var(--muted);
    font-size:13px;
}

.table-responsive{overflow:auto}
table{
    width:100%;
    border-collapse:collapse;
}
th,td{
    padding:14px 12px;
    border-bottom:1px solid var(--line);
    text-align:left;
    vertical-align:top;
}
th{
    color:var(--muted);
    font-size:13px;
}
.sub{
    color:var(--muted);
    font-size:12px;
    margin-top:5px;
}

.badge{
    display:inline-block;
    padding:7px 11px;
    border-radius:999px;
    font-size:12px;
    font-weight:800;
}
.badge.pendente{background:rgba(245,158,11,.14);color:#b45309}
.badge.parcial{background:rgba(250,204,21,.16);color:#a16207}
.badge.agendada{background:rgba(34,199,255,.14);color:#0891b2}
.badge.paga,.badge.paga_inteira{background:rgba(34,197,94,.16);color:#15803d}
.badge.vencida,.badge.vencida_parcial{background:rgba(239,68,68,.14);color:#b91c1c}
.badge.neutral{background:rgba(99,102,241,.14);color:var(--primary)}

.participant-list{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
}
.participant{
    padding:8px 12px;
    border-radius:999px;
    font-size:12px;
    font-weight:700;
}
.participant.paid{background:rgba(34,197,94,.14);color:#15803d}
.participant.pending{background:rgba(245,158,11,.16);color:#b45309}
.participant.scheduled{background:rgba(34,199,255,.16);color:#0891b2}

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

.flash{
    padding:14px 16px;
    border-radius:18px;
    margin-bottom:14px;
    border:1px solid var(--line);
    box-shadow:var(--shadow-soft);
}
.flash-title{
    font-weight:800;
    margin-bottom:4px;
}
.flash.success{background:rgba(34,197,94,.12)}
.flash.error{background:rgba(239,68,68,.10)}

.history-list{
    display:flex;
    flex-direction:column;
    gap:12px;
}
.history-item{
    padding:14px;
    border-radius:18px;
}

.password-wrap{
    display:flex;
    gap:8px;
    align-items:center;
}
.password-wrap input{margin-bottom:0}

.checks-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:10px;
}
.checks-grid.modern .check-card{
    padding:14px;
    border:1px solid var(--line);
    border-radius:18px;
    background:rgba(255,255,255,.06);
    display:flex;
    gap:10px;
    align-items:center;
    font-weight:700;
}
html[data-theme="light"] .checks-grid.modern .check-card{
    background:rgba(255,255,255,.44);
}
.check-card input{
    width:auto;
    margin:0;
}

.participants-checks{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:10px;
}
.check-item{
    display:flex;
    align-items:center;
    gap:8px;
    padding:12px 14px;
    border-radius:16px;
    border:1px solid var(--line);
    background:rgba(255,255,255,.06);
}
html[data-theme="light"] .check-item{
    background:rgba(255,255,255,.44);
}
.check-item input{
    width:auto;
    margin:0;
}

.table-header{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:10px;
    margin-bottom:14px;
}
.align-end{
    display:flex;
    align-items:flex-end;
}
.status-row.vencida,
.status-row.vencida_parcial{
    background:rgba(239,68,68,.05);
}
.status-row.parcial,
.status-row.pendente{
    background:rgba(245,158,11,.04);
}
.status-row.agendada{
    background:rgba(34,199,255,.04);
}

.settings-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:18px;
}
.settings-card{
    padding:24px;
    border-radius:24px;
    border:1px solid var(--line);
    box-shadow:var(--shadow);
}
.settings-card h3{
    margin:12px 0 8px;
}
.settings-card p{
    margin:0 0 14px;
    color:var(--muted);
}
.settings-icon{
    width:60px;
    height:60px;
    border-radius:18px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:26px;
    background:linear-gradient(135deg,var(--primary),var(--blue));
    color:#fff;
    box-shadow:0 14px 28px rgba(109,94,252,.24);
}
.settings-link{
    color:var(--primary);
    font-weight:800;
}
.hover-lift{
    transition:.25s ease;
}
.hover-lift:hover{
    transform:translateY(-6px);
}

.mini-stats{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:12px;
}
.mini-stat{
    border-radius:18px;
    padding:16px;
    border:1px solid var(--line);
    background:rgba(255,255,255,.06);
}
html[data-theme="light"] .mini-stat{
    background:rgba(255,255,255,.44);
}
.mini-stat span{
    display:block;
    color:var(--muted);
    margin-bottom:6px;
}
.mini-stat strong{
    font-size:24px;
}

.category-stack{
    display:flex;
    flex-direction:column;
    gap:12px;
}
.category-row{
    border-radius:18px;
    padding:14px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
}
.category-inline-form{
    display:flex;
    gap:10px;
    align-items:center;
    flex:1;
}
.category-inline-form input{
    margin:0;
}
.category-meta{
    color:var(--muted);
    font-size:13px;
    min-width:190px;
}
.alert-panel{
    margin-top:12px;
    padding-top:6px;
}

.calendar-grid{
    display:grid;
    grid-template-columns:repeat(7,minmax(0,1fr));
    gap:10px;
}
.calendar-head{
    text-align:center;
    font-size:12px;
    font-weight:800;
    color:var(--muted);
    padding-bottom:4px;
}
.calendar-day{
    min-height:120px;
    border-radius:18px;
    padding:10px;
    border:1px solid var(--line);
    background:rgba(255,255,255,.05);
}
html[data-theme="light"] .calendar-day{
    background:rgba(255,255,255,.42);
}
.calendar-day.empty{
    background:transparent;
    border-style:dashed;
}
.calendar-number{
    font-weight:800;
    margin-bottom:8px;
}
.calendar-item{
    font-size:11px;
    padding:6px 8px;
    border-radius:10px;
    margin-bottom:6px;
    background:rgba(255,255,255,.08);
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}
.calendar-item.paga,
.calendar-item.paga_inteira{background:rgba(34,197,94,.18)}
.calendar-item.agendada{background:rgba(34,199,255,.18)}
.calendar-item.parcial,
.calendar-item.pendente{background:rgba(245,158,11,.18)}
.calendar-item.vencida,
.calendar-item.vencida_parcial{background:rgba(239,68,68,.18)}
.calendar-more{
    font-size:11px;
    color:var(--muted);
}

.auth-screen{
    min-height:100vh;
    display:grid;
    grid-template-columns:1.1fr .9fr;
    gap:24px;
    padding:24px;
}
.auth-visual{
    border-radius:32px;
    padding:40px;
    background:
        radial-gradient(circle at top left, rgba(109,94,252,.30), transparent 30%),
        radial-gradient(circle at bottom right, rgba(34,199,255,.24), transparent 28%),
        linear-gradient(135deg, #05070d 0%, #0f1727 40%, #2b1252 100%);
    box-shadow:var(--shadow);
    display:flex;
    align-items:flex-end;
    overflow:hidden;
    position:relative;
}
.auth-visual::after{
    content:"";
    position:absolute;
    width:280px;
    height:280px;
    border-radius:50%;
    right:-70px;
    top:-50px;
    background:rgba(255,255,255,.06);
    filter:blur(10px);
}
.auth-visual-content{
    position:relative;
    z-index:1;
    max-width:720px;
}
.auth-visual h1{
    font-size:48px;
    line-height:1.03;
    margin:10px 0 12px;
    color:#fff;
}
.auth-visual p{
    color:rgba(255,255,255,.72);
    font-size:18px;
    max-width:620px;
}
.auth-panel{
    border-radius:32px;
    padding:34px;
    box-shadow:var(--shadow);
    display:flex;
    flex-direction:column;
    justify-content:center;
}
.auth-brand{
    display:flex;
    gap:14px;
    align-items:center;
    margin-bottom:24px;
}
.auth-brand h2{
    margin:0 0 4px;
    font-size:28px;
}
.auth-brand p{
    margin:0;
    color:var(--muted);
}
.auth-logo{
    width:74px;
    height:74px;
    min-width:74px;
}
.auth-submit{
    width:100%;
    justify-content:center;
    margin-top:8px;
}

.muted{
    color:var(--muted);
}

.animate-in{
    animation:fadeUp .55s ease both;
}
.delay-1{animation-delay:.06s}
.delay-2{animation-delay:.12s}
.delay-3{animation-delay:.18s}
.delay-4{animation-delay:.24s}

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

@media (max-width: 1260px){
    .cards-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
    .settings-grid{grid-template-columns:1fr}
    .charts-grid{grid-template-columns:1fr}
    .grid-6{grid-template-columns:repeat(2,minmax(0,1fr))}
    .calendar-grid{grid-template-columns:repeat(7,minmax(90px,1fr))}
}
@media (max-width: 980px){
    .auth-screen{
        grid-template-columns:1fr;
    }
}
@media (max-width: 920px){
    .app-shell{flex-direction:column}
    .sidebar{
        width:auto;
        margin:14px 14px 0;
    }
    .main-content{
        padding:14px;
    }
    .hero-panel{
        flex-direction:column;
        align-items:flex-start;
    }
    .grid-2,.grid-3,.grid-4,.grid-6,.checks-grid,.participants-checks,.mini-stats,.cards-grid{
        grid-template-columns:1fr;
    }
    .topbar,.table-header{
        flex-direction:column;
        align-items:flex-start;
    }
    .category-row{
        flex-direction:column;
        align-items:stretch;
    }
    .category-inline-form{
        flex-direction:column;
        align-items:stretch;
    }
    .calendar-grid{
        grid-template-columns:1fr;
    }
    .calendar-head{
        display:none;
    }
    .calendar-day{
        min-height:auto;
    }
}
