:root {
    --bg: #f4f6fb;
    --card: #ffffff;
    --ink: #0f172a;
    --ink2: #334155;
    --muted: #7c8aa0;
    --line: #e9edf5;
    --primary: #2f6bff;
    --primary-soft: #eaf0ff;
    --green: #12b76a;
    --green-soft: #e7f8ef;
    --red: #f04438;
    --red-soft: #feeceb;
    --amber: #f79009;
    --amber-soft: #fff5e6;
    --purple: #7a5af8;
    --purple-soft: #f0ecff;
    --radius: 18px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 26px -16px rgba(16, 24, 40, .22);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent
}

html,
body {
    margin: 0;
    padding: 0
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
}

button {
    font-family: inherit
}

img,
svg {
    display: block
}

/* ===== TOPBAR ===== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(244, 246, 251, .92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0
}

.logo {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    flex: none;
    background: linear-gradient(135deg, #2f6bff, #7a5af8);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 16px;
    box-shadow: 0 8px 18px -8px rgba(47, 107, 255, .85);
}

.brand > div {
    min-width: 0
}

.topbar h1 {
    font-size: 16.5px;
    margin: 0;
    font-weight: 750;
    letter-spacing: -.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: none
}

.sound-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    font-size: 16px;
    box-shadow: var(--shadow);
    transition: .15s
}

.sound-btn.on {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff
}

.sound-btn:active {
    transform: scale(.93)
}

.badge-mes {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 8px 11px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--ink2);
    white-space: nowrap;
    box-shadow: var(--shadow);
    margin: 0;
    line-height: inherit;
    cursor: default
}

/* Mobile: só sino + mês/ano; o mês abre o calendário (bottom sheet) */
@media(max-width:719px) {
    .mes-nav {
        display: none
    }

    .badge-mes {
        min-height: 38px;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        gap: 6px
    }

    .badge-mes::after {
        content: '▾';
        font-size: 11px;
        color: var(--muted)
    }

    .badge-mes:active {
        transform: scale(.96)
    }
}

/* ===== LAYOUT ===== */
.wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px
}

.sec {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 22px 0 10px;
    gap: 10px
}

.sec:first-child {
    margin-top: 6px
}

.sec h2 {
    font-size: 13px;
    margin: 0;
    font-weight: 750;
    letter-spacing: .35px;
    color: var(--ink2);
    text-transform: uppercase
}

.sec span {
    font-size: 11.5px;
    color: var(--muted);
    font-weight: 600
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow)
}

.card+.card {
    margin-top: 12px
}

/* ===== HERO ===== */
.hero {
    background: linear-gradient(140deg, #2f6bff 0%, #4d86ff 52%, #7a5af8 100%);
    border-radius: 24px;
    padding: 20px 18px;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 22px 40px -24px rgba(47, 107, 255, .95);
}

.hero::after {
    content: '';
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .10);
    top: -110px;
    right: -70px
}

.hero .lbl {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
    opacity: .86
}

.hero .big {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -1px;
    margin: 6px 0 2px;
    line-height: 1.05
}

.hero .sub {
    font-size: 12.5px;
    opacity: .9;
    font-weight: 600
}

.hero-track {
    height: 9px;
    border-radius: 99px;
    background: rgba(255, 255, 255, .26);
    margin-top: 16px;
    overflow: hidden
}

.hero-fill {
    height: 100%;
    border-radius: 99px;
    background: #fff;
    transition: width .5s cubic-bezier(.4, 0, .2, 1)
}

.hero-foot {
    display: flex;
    justify-content: space-between;
    margin-top: 9px;
    font-size: 11.5px;
    font-weight: 700;
    opacity: .95
}

/* ===== ALERT BANNER ===== */
.alert-banner {
    border-radius: 18px;
    padding: 14px 16px;
    margin-bottom: 12px;
    display: flex;
    gap: 12px;
    align-items: center;
    border: 2px solid transparent;
    animation: pulseBanner 1.4s ease-in-out infinite;
}

@keyframes pulseBanner {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(240, 68, 56, .5)
    }

    50% {
        box-shadow: 0 0 0 10px rgba(240, 68, 56, 0)
    }
}

.alert-banner.danger {
    background: linear-gradient(135deg, #feeceb, #fff5f4);
    border-color: #ffd3cf
}

.alert-banner.warn {
    background: linear-gradient(135deg, #fff5e6, #fffaf0);
    border-color: #ffe2b8;
    animation: pulseBannerWarn 1.8s ease-in-out infinite
}

@keyframes pulseBannerWarn {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(247, 144, 9, .5)
    }

    50% {
        box-shadow: 0 0 0 10px rgba(247, 144, 9, 0)
    }
}

.alert-banner .ic {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    flex: none;
    font-size: 22px
}

.alert-banner.danger .ic {
    background: #ffdedb;
    animation: shake 1s infinite
}

.alert-banner.warn .ic {
    background: #ffe9c9
}

@keyframes shake {

    0%,
    100% {
        transform: rotate(0)
    }

    25% {
        transform: rotate(-8deg)
    }

    75% {
        transform: rotate(8deg)
    }
}

.alert-banner .tt {
    font-size: 14px;
    font-weight: 800;
    margin-bottom: 3px
}

.alert-banner.danger .tt {
    color: #b42318
}

.alert-banner.warn .tt {
    color: #b54708
}

.alert-banner .tx {
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--ink2);
    font-weight: 600
}

/* ===== KPIs ===== */
.kpis {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 12px
}

@media(min-width:720px) {
    .kpis {
        grid-template-columns: repeat(4, 1fr)
    }
}

.kpi {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 13px;
    box-shadow: var(--shadow)
}

.kpi .lbl {
    font-size: 10.5px;
    color: var(--muted);
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: .45px
}

.kpi .val {
    font-size: 16.5px;
    font-weight: 800;
    margin-top: 5px;
    letter-spacing: -.4px
}

.kpi .tag {
    font-size: 10.5px;
    font-weight: 700;
    margin-top: 4px;
    color: var(--muted)
}

.c-green {
    color: var(--green)
}

.c-red {
    color: var(--red)
}

.c-amber {
    color: var(--amber)
}

.c-blue {
    color: var(--primary)
}

.c-purple {
    color: var(--purple)
}

/* ===== SEGMENTED ===== */
.seg {
    display: flex;
    background: #e9edf6;
    border-radius: 14px;
    padding: 4px;
    gap: 4px
}

.seg button {
    flex: 1;
    border: 0;
    background: transparent;
    padding: 10px 6px;
    border-radius: 11px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--muted);
    cursor: pointer;
    transition: .18s
}

.seg button.on {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 2px 10px -3px rgba(16, 24, 40, .22)
}

.seg.mini button {
    font-size: 11.5px;
    padding: 8px 4px
}

/* ===== CHARTS ===== */
.hbars {
    display: flex;
    flex-direction: column;
    gap: 13px
}

.hbar-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px
}

.hbar-lbl {
    font-size: 12.5px;
    font-weight: 650;
    color: var(--ink2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.hbar-val {
    font-size: 12px;
    font-weight: 750;
    color: var(--ink);
    flex: none
}

.track {
    height: 8px;
    border-radius: 99px;
    background: #eef1f7;
    overflow: hidden
}

.fill {
    height: 100%;
    border-radius: 99px;
    transition: width .55s cubic-bezier(.4, 0, .2, 1)
}

.vbars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 130px;
    padding-top: 8px
}

.vbar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    height: 100%;
    min-width: 0
}

.vbar-col {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center
}

.vbar-fill {
    width: 100%;
    max-width: 26px;
    border-radius: 6px 6px 3px 3px;
    background: linear-gradient(180deg, #5b90ff, #2f6bff);
    min-height: 3px;
    transition: height .55s cubic-bezier(.4, 0, .2, 1)
}

.vbar-lbl {
    font-size: 9.5px;
    color: var(--muted);
    font-weight: 700
}

.donut-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap
}

.donut {
    width: 132px;
    height: 132px;
    flex: none
}

.legend {
    flex: 1;
    min-width: 170px;
    display: flex;
    flex-direction: column;
    gap: 9px
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px
}

.dot {
    width: 9px;
    height: 9px;
    border-radius: 3px;
    flex: none
}

.legend-row .nm {
    flex: 1;
    color: var(--ink2);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.legend-row .vl {
    font-weight: 750;
    font-size: 12px
}

/* ===== KANBAN BOARD ===== */
.board-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 14px
}

.board-toolbar .search {
    flex: 1;
    min-width: 180px;
    border: 0;
    box-shadow: none;
    padding: 6px 8px
}

.board-toolbar select {
    font-family: inherit;
    font-size: 12px;
    font-weight: 650;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fbfcfe;
    color: var(--ink2);
    outline: none
}

.board {
    display: grid;
    grid-template-columns: repeat(5, minmax(260px, 1fr));
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
    scrollbar-width: thin
}

.board::-webkit-scrollbar {
    height: 8px
}

.board::-webkit-scrollbar-thumb {
    background: #dfe4ee;
    border-radius: 99px
}

@media(max-width:1100px) {
    .board {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: 280px
    }
}

.col {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    min-height: 300px
}

.col-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--line);
    margin-bottom: 10px
}

.col-head .bullet {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: none
}

.col-head .nome {
    flex: 1;
    font-size: 12.5px;
    font-weight: 800;
    letter-spacing: .2px;
    text-transform: uppercase
}

.col-head .qtd {
    background: #f1f4fa;
    color: var(--ink2);
    font-size: 10.5px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 99px
}

.col-head .soma {
    font-size: 10.5px;
    font-weight: 800;
    color: var(--muted)
}

.col-body {
    display: flex;
    flex-direction: column;
    gap: 9px;
    flex: 1
}

/* Column types */
.col.c-atrasada {
    border-color: #ffd3cf;
    background: linear-gradient(180deg, #fff8f8, #fff)
}

.col.c-atrasada .bullet {
    background: var(--red);
    animation: pulseDot 1s infinite
}

@keyframes pulseDot {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(240, 68, 56, .7)
    }

    50% {
        box-shadow: 0 0 0 6px rgba(240, 68, 56, 0)
    }
}

.col.c-hoje {
    border-color: #ffe2b8;
    background: linear-gradient(180deg, #fffdf7, #fff)
}

.col.c-hoje .bullet {
    background: var(--amber)
}

.col.c-semana .bullet {
    background: #fbbf24
}

.col.c-mes .bullet {
    background: var(--primary)
}

.col.c-pagas {
    border-color: #c9eedb;
    background: linear-gradient(180deg, #f6fdf9, #fff)
}

.col.c-pagas .bullet {
    background: var(--green)
}

/* Task card */
.task {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    box-shadow: 0 2px 8px -4px rgba(16, 24, 40, .08);
    position: relative;
    transition: .18s
}

.task:active {
    transform: scale(.98)
}

.task.crit {
    animation: cardPulse 1.6s ease-in-out infinite
}

@keyframes cardPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(240, 68, 56, .35)
    }

    50% {
        box-shadow: 0 0 0 6px rgba(240, 68, 56, 0)
    }
}

.task.warn {
    animation: cardPulseWarn 2s ease-in-out infinite
}

@keyframes cardPulseWarn {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(247, 144, 9, .35)
    }

    50% {
        box-shadow: 0 0 0 5px rgba(247, 144, 9, 0)
    }
}

.task-top {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 8px
}

.task .avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    flex: none;
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 800;
    color: #fff
}

.task .info {
    flex: 1;
    min-width: 0
}

.task .nm {
    font-size: 13px;
    font-weight: 750;
    line-height: 1.25;
    word-break: break-word
}

.task .cat {
    font-size: 10.5px;
    color: var(--muted);
    font-weight: 650;
    margin-top: 2px
}

.task .valor {
    font-size: 14.5px;
    font-weight: 800;
    letter-spacing: -.3px;
    text-align: right;
    flex: none
}

.task-dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin: 9px 0;
    padding: 8px;
    background: #f8fafd;
    border-radius: 10px
}

.date-cell {
    display: flex;
    flex-direction: column;
    gap: 1px
}

.date-cell .lbl {
    font-size: 9px;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .4px
}

.date-cell .val {
    font-size: 11.5px;
    font-weight: 750;
    color: var(--ink2)
}

.date-cell .val.red {
    color: var(--red)
}

.date-cell .val.green {
    color: var(--green)
}

.countdown {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 99px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .3px;
    text-transform: uppercase;
    margin-bottom: 8px
}

.cd-late {
    background: var(--red-soft);
    color: #b42318
}

.cd-today {
    background: var(--amber-soft);
    color: #b54708
}

.cd-soon {
    background: #fef3c7;
    color: #92400e
}

.cd-future {
    background: var(--primary-soft);
    color: #1d4ed8
}

.cd-paid {
    background: var(--green-soft);
    color: #067647
}

.task-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 9px
}

.tagm {
    font-size: 9.5px;
    font-weight: 700;
    background: #f1f4fa;
    color: #5b6b82;
    padding: 3px 7px;
    border-radius: 7px
}

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

.task-actions .btn {
    padding: 8px 10px;
    font-size: 11px;
    flex: 1
}

.btn {
    border: 0;
    border-radius: 11px;
    padding: 10px 14px;
    font-size: 12.5px;
    font-weight: 750;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: .15s
}

.btn.primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 16px -10px rgba(47, 107, 255, 1)
}

.btn.ghost {
    background: #f1f4fa;
    color: var(--ink2)
}

.btn.danger {
    background: var(--red-soft);
    color: #b42318
}

.btn.green {
    background: var(--green);
    color: #fff
}

.btn.sm {
    flex: none;
    padding: 8px 12px;
    font-size: 11.5px
}

.btn:active {
    transform: scale(.97)
}

.btn:disabled {
    opacity: .5;
    cursor: default
}

/* ===== FAB ===== */
.fab {
    position: fixed;
    right: 18px;
    bottom: calc(92px + env(safe-area-inset-bottom));
    z-index: 45;
    width: 56px;
    height: 56px;
    border-radius: 20px;
    border: 0;
    cursor: pointer;
    background: linear-gradient(135deg, #2f6bff, #7a5af8);
    color: #fff;
    font-size: 26px;
    font-weight: 300;
    display: grid;
    place-items: center;
    box-shadow: 0 16px 30px -12px rgba(47, 107, 255, .95);
    transition: .18s
}

.fab:active {
    transform: scale(.93)
}

/* ===== LISTAS ===== */
.row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line)
}

.row:last-child {
    border-bottom: 0;
    padding-bottom: 0
}

.row:first-child {
    padding-top: 0
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    flex: none;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.3px
}

.row .info {
    flex: 1;
    min-width: 0
}

.row .t1 {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.row .t2 {
    font-size: 11.5px;
    color: var(--muted);
    font-weight: 600;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.row .val {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -.3px;
    text-align: right;
    flex: none
}

/* ===== PILLS ===== */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 99px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .3px;
    text-transform: uppercase
}

.pill.ok {
    background: var(--green-soft);
    color: #067647
}

.pill.warn {
    background: var(--amber-soft);
    color: #b54708
}

.pill.dan {
    background: var(--red-soft);
    color: #b42318
}

.pill.info {
    background: var(--primary-soft);
    color: #1d4ed8
}

.pill.mut {
    background: #eef1f7;
    color: #5b6b82
}

/* ===== ALERTAS ===== */
.alert {
    display: flex;
    gap: 11px;
    padding: 13px;
    border-radius: 15px;
    margin-bottom: 9px;
    border: 1px solid transparent
}

.alert:last-child {
    margin-bottom: 0
}

.alert .ic {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    flex: none;
    font-size: 14px
}

.alert .tt {
    font-size: 12.5px;
    font-weight: 800;
    margin-bottom: 3px
}

.alert .tx {
    font-size: 12px;
    line-height: 1.5;
    color: var(--ink2);
    font-weight: 500
}

.a-ok {
    background: var(--green-soft);
    border-color: #c9eedb
}

.a-ok .ic {
    background: #d3f4e3;
    color: #067647
}

.a-ok .tt {
    color: #067647
}

.a-warn {
    background: var(--amber-soft);
    border-color: #ffe2b8
}

.a-warn .ic {
    background: #ffe9c9;
    color: #b54708
}

.a-warn .tt {
    color: #b54708
}

.a-dan {
    background: var(--red-soft);
    border-color: #ffd3cf
}

.a-dan .ic {
    background: #ffdedb;
    color: #b42318
}

.a-dan .tt {
    color: #b42318
}

.a-info {
    background: var(--primary-soft);
    border-color: #d3e0ff
}

.a-info .ic {
    background: #dbe6ff;
    color: #1d4ed8
}

.a-info .tt {
    color: #1d4ed8
}

/* ===== FORM ===== */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 13px
}

.field label {
    font-size: 11.5px;
    font-weight: 750;
    color: var(--ink2);
    letter-spacing: .15px
}

.field input,
.field select {
    font-family: inherit;
    font-size: 15px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #fbfcfe;
    color: var(--ink);
    outline: none;
    width: 100%;
    transition: .15s
}

.field input:focus,
.field select:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px var(--primary-soft)
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px
}

.switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line)
}

.switch:last-child {
    border-bottom: 0
}

.switch .tt {
    font-size: 13px;
    font-weight: 700
}

.switch .tx {
    font-size: 11.5px;
    color: var(--muted);
    font-weight: 600;
    margin-top: 2px
}

.toggle {
    width: 50px;
    height: 30px;
    border-radius: 99px;
    background: #dfe4ee;
    border: 0;
    position: relative;
    cursor: pointer;
    flex: none;
    transition: .2s
}

.toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    transition: .2s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .18)
}

.toggle.on {
    background: var(--green)
}

.toggle.on::after {
    left: 23px
}

/* ===== SHEET ===== */
.sheet-bg {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    backdrop-filter: blur(3px);
    z-index: 60;
    opacity: 0;
    pointer-events: none;
    transition: .25s
}

.sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 61;
    background: #fff;
    border-radius: 26px 26px 0 0;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    transform: translateY(102%);
    visibility: hidden;
    pointer-events: none;
    transition: transform .32s cubic-bezier(.32, .72, 0, 1), visibility 0s .32s;
    box-shadow: 0 -20px 50px -20px rgba(15, 23, 42, .4)
}

body.sheet-open .sheet {
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
    transition: transform .32s cubic-bezier(.32, .72, 0, 1), visibility 0s
}

body.sheet-open .sheet-bg {
    opacity: 1;
    pointer-events: auto
}

@media(min-width:760px) {
    .sheet {
        left: 50%;
        right: auto;
        bottom: auto;
        top: 50%;
        width: 600px;
        max-height: 88vh;
        border-radius: 24px;
        transform: translate(-50%, -46%) scale(.96);
        opacity: 0
    }

    body.sheet-open .sheet {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1
    }
}

.sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 18px 12px;
    border-bottom: 1px solid var(--line);
    flex: none
}

.sheet-head h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -.2px
}

.sheet-head button {
    border: 0;
    background: #f1f4fa;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    font-size: 15px;
    color: var(--ink2);
    cursor: pointer;
    font-weight: 700
}

.sheet-body {
    padding: 16px 18px calc(20px + env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch
}

.sheet-grab {
    width: 38px;
    height: 4px;
    border-radius: 99px;
    background: #dfe4ee;
    margin: 9px auto 0;
    flex: none
}

/* ===== TABBAR ===== */
.tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    background: rgba(255, 255, 255, .95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
    display: flex;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom))
}

.tabbar button {
    flex: 1;
    border: 0;
    background: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 7px 2px;
    font-size: 10px;
    font-weight: 750;
    color: var(--muted);
    cursor: pointer;
    transition: .15s
}

.tabbar button.on {
    color: var(--primary)
}

.tabbar svg {
    width: 21px;
    height: 21px;
    stroke: currentColor;
    stroke-width: 1.9;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round
}

/* ===== MISC ===== */
.empty {
    text-align: center;
    padding: 24px 12px;
    color: var(--muted)
}

.empty .em {
    font-size: 24px;
    margin-bottom: 8px
}

.empty .tx {
    font-size: 12px;
    font-weight: 650
}

.prog-mini {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 7px
}

.prog-mini .track {
    flex: 1;
    height: 6px
}

.mt8 {
    margin-top: 8px
}

.mt12 {
    margin-top: 12px
}

.mt16 {
    margin-top: 16px
}

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

.small {
    font-size: 11.5px;
    font-weight: 600
}

.divider {
    height: 1px;
    background: var(--line);
    margin: 14px 0
}

.grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px
}

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

@media(min-width:720px) {
    .wide {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 14px;
        align-items: start
    }
}

.stat-box {
    background: #f8fafd;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px
}

.stat-box .l {
    font-size: 10.5px;
    font-weight: 750;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .4px
}

.stat-box .v {
    font-size: 15px;
    font-weight: 800;
    margin-top: 4px;
    letter-spacing: -.3px
}

.hint {
    font-size: 11.5px;
    color: var(--muted);
    font-weight: 600;
    line-height: 1.55
}

.chips {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding: 2px 0 4px;
    scrollbar-width: none
}

.chips::-webkit-scrollbar {
    display: none
}

.chip {
    flex: none;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink2);
    padding: 8px 13px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: .15s
}

.chip.on {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 6px 14px -8px rgba(47, 107, 255, .9)
}

.search {
    display: flex;
    align-items: center;
    gap: 9px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 11px 13px;
    box-shadow: var(--shadow)
}

.search input {
    border: 0;
    outline: 0;
    font-size: 14px;
    font-family: inherit;
    flex: 1;
    background: transparent;
    color: var(--ink);
    min-width: 0
}

.search svg {
    width: 17px;
    height: 17px;
    stroke: var(--muted);
    stroke-width: 2;
    fill: none;
    flex: none
}

.tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px
}

.tbl th {
    text-align: left;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--muted);
    font-weight: 800;
    padding: 8px 6px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap
}

.tbl td {
    padding: 10px 6px;
    border-bottom: 1px solid var(--line);
    font-weight: 600;
    color: var(--ink2);
    white-space: nowrap
}

.tbl tr:last-child td {
    border-bottom: 0
}

.tbl .r {
    text-align: right
}

.tbl-scroll {
    overflow-x: auto;
    margin: 0 -4px;
    padding: 0 4px
}
/* Estados de sessão e papéis */
body.deslogado .tabbar, body.deslogado .top-actions { display: none; }
body.somente-leitura [data-act="newdesp"], body.somente-leitura [data-act="pay"], body.somente-leitura [data-act="unpay"],
body.somente-leitura [data-act="edit"], body.somente-leitura [data-act="del"], body.somente-leitura [data-act="gerarMes"],
body.somente-leitura .fab { display: none !important; }
body.nao-admin [data-act^="add"], body.nao-admin [data-act="delCat"], body.nao-admin [data-act="delCentro"],
body.nao-admin [data-act="delTipo"], body.nao-admin [data-act="delBanco"], body.nao-admin [data-act="delUser"],
body.nao-admin [data-act="saveCfg"], body.nao-admin [data-act="salvarAsaas"], body.nao-admin [data-act="toggleAsaas"], body.nao-admin .so-admin,
body.nao-admin [data-meta],
body.nao-admin [data-act="exportar"], body.nao-admin [data-act="restaurar"], body.nao-admin [data-act="historicoBackups"] { display: none !important; }

/* Calendário de competência (bottom sheet, só no mobile) */
.cal-ano {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px
}

.cal-ano strong {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -.2px
}

.cal-grade {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px
}

.cal-mes {
    min-height: 46px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink2);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer
}

.cal-mes.atual {
    border-color: #b9cbff;
    color: var(--primary)
}

.cal-mes.on {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff
}

.cal-mes:active {
    transform: scale(.96)
}

/* Alertas visuais pulsantes desligados (preferência do aparelho) */
body.sem-pulso .alert-banner,
body.sem-pulso .alert-banner.warn,
body.sem-pulso .alert-banner.danger .ic,
body.sem-pulso .col.c-atrasada .bullet,
body.sem-pulso .task.crit,
body.sem-pulso .task.warn {
    animation: none
}
