/* =========================================================
   CORES E CONFIGURAÇÕES GERAIS
========================================================= */

:root{
    --bg:#040914;
    --panel:#0a1425;
    --panel2:#0d1b31;
    --line:#173052;

    --text:#eef6ff;
    --muted:#88a1bc;

    --blue:#34a7ff;
    --cyan:#54e5ff;
    --green:#4ce4a3;
    --red:#ff6688;
    --amber:#ffc65a;

    --shadow:0 18px 55px rgba(0,0,0,.34);
}

/* =========================================================
   RESET / BASE
========================================================= */

*{
    box-sizing:border-box;
}

html{
    background:var(--bg);
}

body{
    margin:0;
    background:
        radial-gradient(
            circle at 85% -10%,
            #0c3561 0,
            transparent 38%
        ),
        linear-gradient(
            180deg,
            #06101e,
            #040914 52%
        );

    color:var(--text);

    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    min-height:100vh;
}

/* =========================================================
   ESTRUTURA PRINCIPAL
========================================================= */

.app-shell{
    width:100%;
    max-width:980px;
    margin:auto;
    min-height:100vh;
    padding-bottom:88px;
}

.content{
    width:100%;
    padding:14px 14px 36px;
}

/* =========================================================
   BARRA SUPERIOR
========================================================= */

.topbar{
    position:sticky;
    top:0;
    z-index:30;

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

    padding:18px 16px 14px;

    background:rgba(4,9,20,.84);

    backdrop-filter:blur(18px);

    border-bottom:
        1px solid
        rgba(84,229,255,.08);
}

.topbar h1{
    font-size:20px;
    margin:2px 0 0;
}

.eyebrow{
    font-size:10px;
    letter-spacing:.18em;
    color:var(--cyan);
}

.avatar{
    width:42px;
    height:42px;

    border-radius:14px;

    display:grid;
    place-items:center;

    background:
        linear-gradient(
            135deg,
            #123a64,
            #0c223e
        );

    border:1px solid #205b91;

    color:white;
    text-decoration:none;

    font-weight:800;

    box-shadow:
        0 0 24px
        rgba(52,167,255,.16);
}

/* =========================================================
   CARD PRINCIPAL / HERO
========================================================= */

.hero{
    width:100%;

    padding:20px;

    border:1px solid #163254;

    border-radius:24px;

    background:
        linear-gradient(
            145deg,
            rgba(15,35,61,.96),
            rgba(6,17,31,.98)
        );

    box-shadow:var(--shadow);

    margin-bottom:14px;
}

/* =========================================================
   PAINEL SUPERIOR DO ADMIN
   FATURAMENTO + ECONOMIA
========================================================= */

.hero-admin{
    display:grid;

    grid-template-columns:
        minmax(0,1fr)
        minmax(0,1fr);

    gap:20px;

    align-items:stretch;
}

/* Faturamento */

.hero-main-stat{
    min-width:0;

    display:flex;
    flex-direction:column;
    justify-content:center;
}

/* Economia */

.hero-side-stat{
    min-width:0;

    display:flex;
    flex-direction:column;
    justify-content:center;

    padding-left:20px;

    border-left:
        1px solid
        rgba(84,229,255,.12);
}

/* Texto dos indicadores */

.hero .label{
    color:var(--muted);
    font-size:12px;
}

.hero .big{
    font-size:34px;
    font-weight:850;

    letter-spacing:-.04em;

    margin:6px 0;
}

.hero .big.negative{
    color:var(--red);
}

.hero .big.positive{
    color:var(--green);
}

/* =========================================================
   LINHA DE INFORMAÇÕES / CHIPS
========================================================= */

.subline{
    display:flex;
    gap:8px;
    flex-wrap:wrap;

    color:var(--muted);
    font-size:12px;
}

.chip{
    padding:6px 9px;

    border-radius:999px;

    background:#0c2038;

    border:1px solid #173858;
}

/* =========================================================
   GRID DE CARDS
========================================================= */

.grid{
    display:grid;

    grid-template-columns:
        repeat(3,minmax(0,1fr));

    gap:10px;
}

.card{
    min-width:0;

    background:
        linear-gradient(
            145deg,
            rgba(13,27,49,.92),
            rgba(7,16,29,.96)
        );

    border:1px solid #142c49;

    border-radius:20px;

    padding:15px;

    box-shadow:
        0 12px 35px
        rgba(0,0,0,.17);
}

.card .kpi{
    font-size:22px;
    font-weight:800;
    margin-top:5px;
}

/* =========================================================
   TEXTOS
========================================================= */

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

.small{
    font-size:12px;
}

.positive{
    color:var(--green);
}

.negative{
    color:var(--red);
}

/* =========================================================
   TÍTULOS DE SEÇÃO
========================================================= */

.section-title{
    display:flex;

    align-items:center;
    justify-content:space-between;

    gap:10px;

    margin:20px 2px 10px;
}

.section-title h2{
    font-size:15px;
    margin:0;
}

/* =========================================================
   LANÇAMENTOS RÁPIDOS
========================================================= */

.actions{
    display:grid;

    grid-template-columns:
        repeat(2,minmax(0,1fr));

    gap:10px;
}

.action{
    min-height:104px;

    padding:16px;

    border-radius:21px;

    text-decoration:none;
    color:#fff;

    border:1px solid #19456f;

    background:
        linear-gradient(
            145deg,
            #0e2744,
            #0a1728
        );

    display:flex;
    flex-direction:column;
    justify-content:space-between;

    min-width:0;
}

.action strong{
    font-size:16px;
}

.action.primary{
    background:
        linear-gradient(
            145deg,
            #0c6fc0,
            #0b3158
        );

    border-color:#2689d3;
}

.action.good{
    background:
        linear-gradient(
            145deg,
            #08795d,
            #0a3029
        );

    border-color:#159c77;
}

.action.danger{
    background:
        linear-gradient(
            145deg,
            #713047,
            #25121d
        );

    border-color:#8d3b58;
}

.action .icon{
    font-size:25px;
}

/* =========================================================
   LISTAS / HISTÓRICO
========================================================= */

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

.row{
    display:flex;

    gap:12px;

    justify-content:space-between;
    align-items:center;

    padding:13px 14px;

    border:1px solid #142b47;

    border-radius:16px;

    background:#091322;

    min-width:0;
}

.row.cancelled{
    opacity:.56;
    text-decoration:line-through;
}

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

.row .title{
    font-weight:700;

    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.row .meta{
    font-size:11px;
    color:var(--muted);
    margin-top:3px;

    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.amount{
    font-weight:800;
    text-align:right;
    white-space:nowrap;
}

/* =========================================================
   FORMULÁRIOS
========================================================= */

.form-card{
    background:#091423;

    border:1px solid #15304f;

    border-radius:22px;

    padding:16px;
}

.field{
    margin-bottom:14px;
}

.field label{
    display:block;

    font-size:12px;

    color:#9ab0c8;

    margin-bottom:7px;
}

.field input,
.field select,
.field textarea{
    width:100%;

    border:1px solid #1c3c61;

    background:#06101d;

    color:white;

    border-radius:14px;

    padding:13px 14px;

    font:inherit;

    outline:none;

    min-width:0;
}

.field input:focus,
.field select:focus,
.field textarea:focus{
    border-color:#39a9ff;

    box-shadow:
        0 0 0 3px
        rgba(52,167,255,.12);
}

/* =========================================================
   BOTÕES
========================================================= */

.btn{
    display:inline-flex;

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

    gap:8px;

    border:0;

    border-radius:14px;

    padding:13px 15px;

    font-weight:800;

    text-decoration:none;

    cursor:pointer;

    background:#168ce4;

    color:#fff;
}

.btn.secondary{
    background:#10253d;

    color:#d8ebff;

    border:1px solid #20466e;
}

.btn.danger{
    background:#8a2948;
}

.btn.full{
    width:100%;
}

.btn-row{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
}

/* =========================================================
   MENSAGENS
========================================================= */

.flash{
    padding:12px 14px;

    border-radius:14px;

    margin-bottom:12px;

    border:1px solid;
}

.flash.success{
    background:#09291f;

    border-color:#14654e;

    color:#9ff5d5;
}

.flash.error{
    background:#2a1119;

    border-color:#6e283f;

    color:#ffc1d1;
}

/* =========================================================
   ABAS
========================================================= */

.tabs{
    display:flex;

    gap:6px;

    overflow-x:auto;

    padding-bottom:4px;

    scrollbar-width:none;
}

.tabs::-webkit-scrollbar{
    display:none;
}

.tabs a{
    padding:8px 11px;

    border-radius:999px;

    background:#0b1b2e;

    border:1px solid #173453;

    color:#afc7df;

    text-decoration:none;

    font-size:12px;

    white-space:nowrap;
}

.tabs a.active{
    background:#113a5f;

    border-color:#2b84c7;

    color:#fff;
}

/* =========================================================
   MENU INFERIOR MOBILE
========================================================= */

.bottom-nav{
    position:fixed;

    left:50%;

    transform:translateX(-50%);

    bottom:0;

    width:min(980px,100%);

    z-index:40;

    display:grid;

    grid-auto-flow:column;

    grid-auto-columns:1fr;

    background:rgba(5,12,23,.92);

    border-top:1px solid #142b46;

    backdrop-filter:blur(16px);

    padding:
        9px
        8px
        max(9px,env(safe-area-inset-bottom));
}

.bottom-nav a{
    color:#8fa8c1;

    text-decoration:none;

    text-align:center;

    font-size:18px;
}

.bottom-nav span{
    display:block;

    font-size:10px;

    margin-top:2px;
}

/* =========================================================
   LOGIN
========================================================= */

.login-wrap{
    min-height:100vh;

    display:grid;

    place-items:center;

    padding:22px;
}

.login-card{
    width:min(430px,100%);

    padding:26px;

    border-radius:28px;

    background:
        linear-gradient(
            155deg,
            rgba(12,29,51,.96),
            rgba(5,13,24,.98)
        );

    border:1px solid #173b60;

    box-shadow:
        0 30px 80px
        rgba(0,0,0,.5);
}

.brand-orb{
    width:76px;
    height:76px;

    border-radius:24px;

    background:
        radial-gradient(
            circle at 30% 25%,
            #67e9ff,
            #168fe5 35%,
            #0b2a4c 70%
        );

    box-shadow:
        0 0 55px
        rgba(52,167,255,.3);

    display:grid;
    place-items:center;

    font-weight:950;
    font-size:26px;

    margin-bottom:20px;
}

.login-card h1{
    margin:0 0 4px;
}

.install-btn{
    display:inline-flex;
    margin-top:10px;
}

.install-help{
    display:none;
    margin:10px 0 0;
    color:var(--muted);
    font-size:.86rem;
    line-height:1.45;
}

.install-help.visible{
    display:block;
}

/* =========================================================
   INDICADORES SECUNDÁRIOS
========================================================= */

.stat-strip{
    display:grid;

    grid-template-columns:
        1fr 1fr;

    gap:10px;

    margin-top:10px;
}

.bar{
    height:8px;

    border-radius:99px;

    background:#0a1a2d;

    overflow:hidden;
}

.bar>i{
    display:block;

    height:100%;

    background:
        linear-gradient(
            90deg,
            #238fde,
            #55e6ff
        );
}

/* =========================================================
   TABELAS
========================================================= */

.table-wrap{
    overflow-x:auto;

    border-radius:18px;

    border:1px solid #142e4b;

    width:100%;
}

.table{
    width:100%;

    border-collapse:collapse;

    min-width:720px;

    background:#081321;
}

.table th,
.table td{
    padding:12px;

    border-bottom:1px solid #11253d;

    text-align:left;

    font-size:12px;
}

.table th{
    color:#8ca8c3;

    background:#0b192a;
}

/* =========================================================
   BADGES
========================================================= */

.badge{
    display:inline-flex;

    padding:4px 8px;

    border-radius:999px;

    font-size:10px;

    background:#0e2a46;

    border:1px solid #1b4c79;
}

.badge.cancel{
    background:#341521;

    border-color:#733046;

    color:#ffb8cb;
}

/* =========================================================
   AUDITORIA
========================================================= */

.audit{
    font-size:12px;

    background:#07111f;

    border:1px solid #122b47;

    padding:10px;

    border-radius:12px;

    margin:7px 0;
}

.audit code{
    white-space:pre-wrap;

    color:#a9c6df;
}

/* =========================================================
   OBSERVAÇÕES
========================================================= */

.note{
    font-size:11px;

    color:#7f9ab4;

    margin-top:8px;
}

/* =========================================================
   FILTROS DE RELATÓRIO
========================================================= */

.report-filters{
    display:grid;

    grid-template-columns:
        repeat(2,minmax(0,1fr));

    gap:10px;
}

.report-filters .field{
    min-width:0;
}

.report-filters input,
.report-filters select{
    max-width:100%;

    min-width:0;
}

/* =========================================================
   INDICADORES DOS RELATÓRIOS
========================================================= */

.report-kpis{
    display:grid;

    grid-template-columns:
        repeat(3,minmax(0,1fr));

    gap:10px;

    margin-top:12px;
}

.report-kpis .card{
    min-width:0;
}

.report-kpis .kpi{
    font-size:20px;

    overflow:hidden;

    text-overflow:ellipsis;
}

/* =========================================================
   DESKTOP
========================================================= */

@media (min-width:700px){

    .content{
        padding:20px;
    }

    .grid{
        grid-template-columns:
            repeat(3,minmax(0,1fr));
    }

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

    .topbar{
        padding-left:20px;
        padding-right:20px;
    }

}

/* =========================================================
   CELULAR
========================================================= */

@media (max-width:699px){

    .app-shell{
        width:100%;
    }

    .content{
        padding:
            12px
            12px
            90px;
    }

    /* ---------------------------------------------
       TOPO ADMIN
    --------------------------------------------- */

    .hero-admin{

        grid-template-columns:
            minmax(0,1fr)
            minmax(0,1fr);

        gap:10px;

        padding:15px;
    }

    .hero-main-stat{
        padding-right:8px;
    }

    .hero-side-stat{

        padding-left:12px;

        border-left:
            1px solid
            rgba(84,229,255,.12);
    }

    .hero .big{
        font-size:25px;
    }

    .hero .label{
        font-size:10px;
    }

    /* ---------------------------------------------
       CARDS DE HOJE
    --------------------------------------------- */

    .grid{
        grid-template-columns:
            repeat(2,minmax(0,1fr));
    }

    .card{
        padding:13px;
    }

    .card .kpi{
        font-size:19px;
    }

    /* ---------------------------------------------
       LANÇAMENTOS
    --------------------------------------------- */

    .actions{
        grid-template-columns:
            repeat(2,minmax(0,1fr));
    }

    .action{
        min-height:100px;

        padding:14px;
    }

    .action strong{
        font-size:14px;
    }

    /* ---------------------------------------------
       HISTÓRICO
    --------------------------------------------- */

    .section-title{
        margin-top:18px;
    }

    .row{
        padding:12px;
    }

    .row .title{
        font-size:13px;
    }

    .row .meta{
        font-size:10px;
    }

    .amount{
        font-size:13px;
    }

    /* ---------------------------------------------
       FORMULÁRIOS
    --------------------------------------------- */

    .form-card{
        padding:14px;
    }

    .field input,
    .field select,
    .field textarea{
        font-size:16px;
    }

    /* ---------------------------------------------
       BOTÕES
    --------------------------------------------- */

    .btn-row{
        width:100%;
    }

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

    /* ---------------------------------------------
       RELATÓRIOS
    --------------------------------------------- */

    .report-filters{
        grid-template-columns:
            1fr 1fr;

        gap:8px;
    }

    .report-kpis{
        grid-template-columns:
            1fr 1fr;
    }

    .report-kpis .card{
        padding:13px;
    }

    .report-kpis .kpi{
        font-size:18px;
    }

    /* ---------------------------------------------
       TABELAS
    --------------------------------------------- */

    .table-wrap{
        max-width:100%;

        overflow-x:auto;

        -webkit-overflow-scrolling:touch;
    }

}

/* =========================================================
   CELULARES PEQUENOS
========================================================= */

@media (max-width:380px){

    .content{
        padding-left:10px;
        padding-right:10px;
    }

    /* Topo continua lado a lado */

    .hero-admin{
        grid-template-columns:
            minmax(0,1fr)
            minmax(0,1fr);

        gap:8px;

        padding:13px;
    }

    .hero .big{
        font-size:22px;
    }

    .hero-side-stat{
        padding-left:9px;
    }

    .grid{
        gap:8px;
    }

    .card{
        padding:11px;
    }

    .card .kpi{
        font-size:17px;
    }

    .actions{
        gap:8px;
    }

    .action{
        padding:12px;
        min-height:94px;
    }

    .action strong{
        font-size:13px;
    }

    .action .icon{
        font-size:21px;
    }

    .report-filters{
        grid-template-columns:
            1fr;
    }

    .report-kpis{
        grid-template-columns:
            1fr 1fr;
    }

    .report-kpis .kpi{
        font-size:17px;
    }

}

/* =========================================================
   TELAS MUITO ESTREITAS
========================================================= */

@media (max-width:330px){

    .hero-admin{
        gap:6px;
        padding:11px;
    }

    .hero .big{
        font-size:20px;
    }

    .hero .label{
        font-size:9px;
    }

    .hero-side-stat{
        padding-left:7px;
    }

    .card .kpi{
        font-size:16px;
    }

    .action{
        min-height:90px;
        padding:10px;
    }

    .action strong{
        font-size:12px;
    }

}

/* =========================================================
   ADMIN — PAINEL PRINCIPAL
   ========================================================= */
.hero-admin{
    display:grid !important;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr) !important;
    gap:20px !important;
    align-items:stretch !important;
}
.hero-admin .hero-main-stat,
.hero-admin .hero-side-stat{
    min-width:0;
    display:flex;
    flex-direction:column;
    justify-content:center;
}
.hero-admin .hero-side-stat{
    padding-left:20px;
    border-left:1px solid rgba(84,229,255,.12);
}
.hero-admin .big{
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}
.history-date-nav{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:18px;
    flex-wrap:wrap;
}
.history-date{
    min-width:130px;
    text-align:center;
}
.history-next-disabled{
    opacity:.35;
    pointer-events:none;
}

@media(max-width:699px){
    .hero-admin{
        grid-template-columns:minmax(0,1fr) minmax(0,1fr) !important;
        gap:10px !important;
        padding:15px !important;
    }
    .hero-admin .hero-main-stat{
        padding-right:6px;
    }
    .hero-admin .hero-side-stat{
        padding-left:10px;
    }
    .hero-admin .big{
        font-size:22px;
    }
    .hero-admin .label{
        font-size:9px;
        white-space:nowrap;
    }
    .history-date-nav{
        gap:10px;
    }
}
@media(max-width:380px){
    .hero-admin{
        grid-template-columns:minmax(0,1fr) minmax(0,1fr) !important;
        gap:7px !important;
        padding:12px !important;
    }
    .hero-admin .hero-main-stat{
        padding-right:4px;
    }
    .hero-admin .hero-side-stat{
        padding-left:7px;
    }
    .hero-admin .big{
        font-size:18px;
    }
    .history-date{
        min-width:105px;
    }
}

/* =========================================================
   ÍCONE DA MARCA NA TELA DE LOGIN
   ========================================================= */
.brand-orb{
    overflow:hidden;
}
.brand-icon{
    width:100%;
    height:100%;
    display:block;
    object-fit:cover;
    border-radius:inherit;
}

/* =========================================================
   ADMIN — CARDS DE HOJE E LANÇAMENTOS RÁPIDOS
   ========================================================= */
.admin-today-grid{
    grid-template-columns:repeat(3,minmax(0,1fr));
}
.admin-today-grid .card{
    min-width:0;
}
.admin-today-grid .kpi{
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}
.admin-quick-actions .action{
    min-height:96px;
    justify-content:space-between;
}
.admin-quick-actions .action strong{
    font-size:17px;
}
@media(max-width:699px){
    .admin-today-grid{
        grid-template-columns:repeat(2,minmax(0,1fr));
    }
    .admin-today-grid .card{
        padding:12px;
    }
    .admin-today-grid .kpi{
        font-size:18px;
    }
    .admin-quick-actions .action{
        min-height:94px;
    }
    .admin-quick-actions .action strong{
        font-size:15px;
    }
}
@media(max-width:380px){
    .admin-today-grid{
        gap:7px;
    }
    .admin-today-grid .card{
        padding:10px;
    }
    .admin-today-grid .kpi{
        font-size:16px;
    }
    .admin-today-grid .small{
        font-size:10px;
    }
    .admin-quick-actions .action{
        min-height:88px;
        padding:11px;
    }
    .admin-quick-actions .action strong{
        font-size:13px;
    }
}

/* =========================================================
   ADMIN — CARDS E LANÇAMENTOS
========================================================= */
.admin-today-grid{
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:10px;
}
.admin-today-grid .card{
    min-width:0;
    padding:13px;
}
.admin-today-grid .kpi{
    font-size:20px;
}
.admin-quick-actions{
    grid-template-columns:repeat(4,minmax(0,1fr));
}
.admin-quick-actions .action{
    min-height:104px;
}
.history-date-nav{
    width:100%;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:18px;
    flex-wrap:nowrap;
}
.history-date{
    min-width:110px;
    text-align:center;
    white-space:nowrap;
}
.history-next-disabled{
    opacity:.35;
    pointer-events:none;
}

@media(max-width:699px){
    .admin-today-grid{
        grid-template-columns:repeat(2,minmax(0,1fr));
        gap:8px;
    }
    .admin-today-grid .card{
        padding:11px;
    }
    .admin-today-grid .kpi{
        font-size:18px;
    }
    .admin-quick-actions{
        grid-template-columns:repeat(2,minmax(0,1fr));
    }
    .admin-quick-actions .action{
        min-height:94px;
        padding:14px;
    }
    .admin-quick-actions .action strong{
        font-size:15px;
    }
    .history-date-nav{
        gap:12px;
        justify-content:center;
    }
    .history-date{
        min-width:95px;
    }
}

@media(max-width:380px){
    .admin-today-grid{
        gap:7px;
    }
    .admin-today-grid .card{
        padding:10px;
    }
    .admin-today-grid .kpi{
        font-size:16px;
    }
    .admin-today-grid .small{
        font-size:10px;
    }
    .admin-quick-actions{
        gap:7px;
    }
    .admin-quick-actions .action{
        min-height:88px;
        padding:12px;
    }
    .admin-quick-actions .action strong{
        font-size:14px;
    }
    .history-date-nav{
        gap:8px;
    }
    .history-date{
        min-width:90px;
    }
}

/* =========================================================
   ADMIN — CARDS E LANÇAMENTOS
========================================================= */
.admin-today-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.admin-today-grid .card{min-width:0;padding:13px}
.admin-today-grid .kpi{font-size:20px}
.admin-quick-actions{grid-template-columns:repeat(4,minmax(0,1fr))}
.admin-quick-actions .action{min-height:104px}
.history-date-nav{width:100%;display:flex;align-items:center;justify-content:center;gap:18px;flex-wrap:nowrap}
.history-date{min-width:110px;text-align:center;white-space:nowrap}
.history-next-disabled{opacity:.35;pointer-events:none}
@media(max-width:699px){
.admin-today-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.admin-today-grid .card{padding:11px}
.admin-today-grid .kpi{font-size:18px}
.admin-quick-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
.admin-quick-actions .action{min-height:94px;padding:14px}
.admin-quick-actions .action strong{font-size:15px}
.history-date-nav{gap:12px;justify-content:center}
.history-date{min-width:95px}
}
@media(max-width:380px){
.admin-today-grid{gap:7px}
.admin-today-grid .card{padding:10px}
.admin-today-grid .kpi{font-size:16px}
.admin-today-grid .small{font-size:10px}
.admin-quick-actions{gap:7px}
.admin-quick-actions .action{min-height:88px;padding:12px}
.admin-quick-actions .action strong{font-size:14px}
.history-date-nav{gap:8px}
.history-date{min-width:90px}
}

/* =========================================================
   ESPAÇAMENTO — LANÇAMENTOS E INFORMAÇÕES DIÁRIAS
   ========================================================= */
.daily-info-title{
    margin-top:24px;
}
.daily-info-grid{
    margin-top:0;
}
@media(max-width:699px){
    .daily-info-title{
        margin-top:22px;
        margin-bottom:10px;
    }
}

/* =========================================================
   NAVEGAÇÃO DE DATA SEM RECARREGAMENTO
   ========================================================= */
.history-date-nav{
    width:100%;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:18px;
}
.history-date-btn{
    appearance:none;
}
.history-date-btn:disabled,
.history-next-disabled{
    opacity:.35;
    pointer-events:none;
}
@media(max-width:699px){
    .history-date-nav{
        width:100%;
        justify-content:center;
        gap:12px;
    }
}


/* =========================================================
   INFORMAÇÕES DIÁRIAS DO ADMIN
========================================================= */

.daily-info-title{
    margin-top:28px;
    margin-bottom:12px;
}

.admin-today-grid{
    margin-top:0;
    margin-bottom:24px;
}

@media (max-width:699px){
    .daily-info-title{
        margin-top:28px;
        margin-bottom:12px;
    }

    .admin-today-grid{
        margin-bottom:22px;
    }
}


/* =========================================================
   ADMIN — INFORMAÇÕES DIÁRIAS E NAVEGAÇÃO
   ========================================================= */

.admin-today-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:10px;
    margin-top:0;
    margin-bottom:28px;
}

.daily-info-title{
    margin-top:28px;
    margin-bottom:12px;
}

.history-date-card{
    margin-top:28px;
    margin-bottom:16px;
}

.history-date-nav{
    width:100%;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:18px;
}

.history-date{
    min-width:130px;
    text-align:center;
}

.history-date-btn{
    appearance:none;
    text-decoration:none;
}

.history-next-disabled{
    opacity:.35;
    pointer-events:none;
}

.history-date-card + .list{
    margin-top:16px;
}

@media(max-width:699px){
    .admin-today-grid{
        grid-template-columns:repeat(2,minmax(0,1fr));
        gap:10px;
        margin-bottom:24px;
    }

    .daily-info-title{
        margin-top:24px;
        margin-bottom:12px;
    }

    .history-date-card{
        margin-top:24px;
        margin-bottom:16px;
    }

    .history-date-nav{
        gap:12px;
    }

    .history-date{
        min-width:100px;
    }

    .history-date-card + .list{
        margin-top:16px;
    }
}


/* =========================================================
   INFORMAÇÕES DIÁRIAS — RÓTULO DA DATA
========================================================= */

.daily-info-grid .muted.small,
.admin-today-grid .muted.small{
    line-height:1.35;
}


/* =========================================================
   ÁREA DE INFORMAÇÕES DIÁRIAS
========================================================= */

.daily-info-section{
    width:100%;
    scroll-margin-top:20px;
}

.daily-info-title{
    margin-top:28px;
    margin-bottom:12px;
}

.admin-today-grid{
    margin-bottom:28px;
}

@media(max-width:699px){
    .daily-info-section{
        scroll-margin-top:16px;
    }

    .daily-info-title{
        margin-top:24px;
        margin-bottom:12px;
    }

    .admin-today-grid{
        margin-bottom:24px;
    }
}


/* =========================================================
   TÉCNICOS / USUÁRIOS
========================================================= */

.users-page-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    margin:8px 2px 16px;
}

.users-page-header h2{
    flex:1;
    margin:0;
    text-align:center;
    font-size:20px;
}

.users-new-btn{
    flex-shrink:0;
}

.users-list{
    display:flex;
    flex-direction:column;
    gap:10px;
}

.user-card{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:14px;
    min-width:0;
    padding:14px;
    border:1px solid #142b47;
    border-radius:18px;
    background:
        linear-gradient(
            145deg,
            rgba(13,27,49,.94),
            rgba(7,16,29,.98)
        );
}

.user-card-deleted{
    opacity:.58;
}

.user-info{
    display:flex;
    align-items:center;
    gap:12px;
    min-width:0;
    flex:1;
}

.user-avatar{
    width:44px;
    height:44px;
    flex:0 0 44px;
    display:grid;
    place-items:center;
    border-radius:14px;
    background:#103255;
    border:1px solid #235b8c;
    color:#dff7ff;
    font-size:16px;
    font-weight:850;
}

.user-main{
    min-width:0;
}

.user-name{
    font-size:15px;
    font-weight:800;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.user-email{
    margin-top:3px;
    color:var(--muted);
    font-size:11px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.user-status-line{
    margin-top:6px;
}

.user-status{
    display:inline-flex;
    align-items:center;
    padding:4px 8px;
    border-radius:999px;
    font-size:9px;
    font-weight:850;
    letter-spacing:.04em;
}

.user-status-active{
    color:#9ff5d5;
    background:#09291f;
    border:1px solid #14654e;
}

.user-status-inactive{
    color:#ffd89a;
    background:#2b2110;
    border:1px solid #6f541c;
}

.user-status-deleted{
    color:#ffc1d1;
    background:#341521;
    border:1px solid #733046;
}

.user-actions{
    display:flex;
    align-items:center;
    gap:7px;
    flex-shrink:0;
}

.user-toggle-form{
    margin:0;
}

.user-action-btn,
.user-action-icon{
    min-height:40px;
    border-radius:12px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    text-decoration:none;
    font:inherit;
    font-weight:800;
    cursor:pointer;
}

.user-action-btn{
    padding:0 12px;
    border:1px solid #20466e;
    color:#dff3ff;
    background:#10253d;
}

.user-action-off{
    border-color:#754052;
    background:#321824;
    color:#ffc1d1;
}

.user-action-on{
    border-color:#14654e;
    background:#09291f;
    color:#9ff5d5;
}

.user-action-icon{
    width:40px;
    border:1px solid #20466e;
    background:#10253d;
    color:#dff3ff;
    font-size:18px;
}

.user-action-icon:hover,
.user-action-btn:hover{
    filter:brightness(1.12);
}

.users-empty{
    text-align:center;
    padding:24px 16px;
}


/* =========================================================
   TÉCNICOS — CELULAR
========================================================= */

@media (max-width:699px){

    .users-page-header{
        display:block;
        margin:4px 0 14px;
    }

    .users-page-header h2{
        text-align:center;
        font-size:21px;
        margin-bottom:12px;
    }

    .users-new-btn{
        width:100%;
    }

    .user-card{
        align-items:flex-start;
        padding:13px;
        gap:10px;
    }

    .user-info{
        gap:10px;
    }

    .user-avatar{
        width:42px;
        height:42px;
        flex-basis:42px;
    }

    .user-name{
        font-size:14px;
    }

    .user-email{
        max-width:180px;
    }

    .user-actions{
        gap:6px;
    }

    .user-action-btn{
        min-width:72px;
        padding:0 9px;
        font-size:11px;
    }

    .user-action-icon{
        width:38px;
        min-height:38px;
        font-size:17px;
    }
}


@media (max-width:380px){

    .user-card{
        padding:11px;
    }

    .user-avatar{
        width:38px;
        height:38px;
        flex-basis:38px;
        border-radius:12px;
        font-size:14px;
    }

    .user-name{
        font-size:13px;
    }

    .user-email{
        max-width:145px;
        font-size:10px;
    }

    .user-action-btn{
        min-width:64px;
        padding:0 7px;
        font-size:10px;
    }

    .user-action-icon{
        width:35px;
        min-height:35px;
    }
}

.user-delete-form{margin:0;}
.user-action-delete{width:40px;min-height:40px;border-radius:12px;border:1px solid #754052;background:#321824;color:#ffc1d1;display:inline-flex;align-items:center;justify-content:center;font:inherit;font-size:15px;cursor:pointer;}
.user-action-delete:hover{filter:brightness(1.12);}
@media(max-width:699px){.user-action-delete{width:38px;min-height:38px;font-size:14px;}}
@media(max-width:380px){.user-action-delete{width:35px;min-height:35px;font-size:13px;}}

/* =========================================================
   REVISÃO FINAL — HISTÓRICO
   Mantém todos os estilos anteriores e apenas complementa
   as classes usadas pela tela de histórico.
========================================================= */

.history-page{
    width:100%;
}

.history-page-title{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    margin:4px 2px 14px;
}

.history-page-title h2{
    margin:0;
    font-size:20px;
}

.history-filter-card{
    margin-bottom:14px;
}

.history-filter-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:10px;
}

.history-date-range{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
}

.history-filter-actions{
    display:flex;
    justify-content:flex-end;
    gap:8px;
    margin-top:4px;
}

.history-summary{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:10px;
    margin-bottom:14px;
}

.history-summary .card{
    min-width:0;
}

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

.history-search{
    position:relative;
    flex:1;
    min-width:0;
}

.history-search input{
    width:100%;
    padding-right:44px;
}

.history-search-icon{
    position:absolute;
    right:12px;
    top:50%;
    transform:translateY(-50%);
    color:var(--muted);
    pointer-events:none;
}

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

.history-row{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    min-width:0;
    padding:13px 14px;
    border:1px solid #142b47;
    border-radius:16px;
    background:#091322;
    text-decoration:none;
    color:inherit;
}

.history-row:hover{
    border-color:#24577f;
    background:#0b1829;
}

.history-row.cancelled{
    opacity:.52;
    text-decoration:line-through;
}

.history-row-main{
    display:flex;
    align-items:center;
    gap:10px;
    min-width:0;
    flex:1;
}

.history-row-icon{
    width:38px;
    height:38px;
    flex:0 0 38px;
    display:grid;
    place-items:center;
    border-radius:12px;
    background:#0d2945;
    border:1px solid #1c4b75;
    color:#bdeaff;
}

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

.history-row-title{
    font-weight:800;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.history-row-meta{
    margin-top:4px;
    color:var(--muted);
    font-size:11px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.history-row-side{
    display:flex;
    align-items:center;
    gap:8px;
    flex-shrink:0;
}

.history-row-value{
    font-weight:850;
    white-space:nowrap;
    text-align:right;
}

.history-row-commission{
    color:var(--muted);
    font-size:10px;
    margin-top:3px;
    white-space:nowrap;
    text-align:right;
}

.history-row-actions{
    display:flex;
    align-items:center;
    gap:6px;
}

.history-action-btn{
    width:36px;
    height:36px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border-radius:11px;
    border:1px solid #20466e;
    background:#10253d;
    color:#dff3ff;
    text-decoration:none;
    cursor:pointer;
}

.history-action-btn.danger{
    border-color:#754052;
    background:#321824;
    color:#ffc1d1;
}

.history-action-btn.restore{
    border-color:#14654e;
    background:#09291f;
    color:#9ff5d5;
}

.history-action-btn:hover{
    filter:brightness(1.12);
}

.history-edited{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:18px;
    height:18px;
    border-radius:50%;
    background:#6a4a08;
    border:1px solid #a97b13;
    color:#ffd86b;
    font-size:11px;
    font-weight:900;
    text-decoration:none;
}

.history-empty{
    text-align:center;
    padding:26px 16px;
}

/* =========================================================
   REVISÃO FINAL — TELA DE TÉCNICO
========================================================= */

.user-edit-page{
    width:100%;
}

.user-edit-heading{
    position:relative;
    display:grid;
    grid-template-columns:46px minmax(0,1fr) 46px;
    align-items:center;
    gap:0;
    margin:4px 0 16px;
}

.user-edit-heading > div:nth-child(2){
    grid-column:2;
    justify-self:center;
    width:46px;
    height:46px;
}

.user-edit-heading > div:last-child{
    grid-column:2;
    text-align:center;
    width:100%;
    margin-top:58px;
}

.user-edit-heading h2{
    margin:0;
    font-size:21px;
    text-align:center;
}

.user-edit-heading p{
    margin:5px 0 0;
    color:var(--muted);
    font-size:11px;
    text-align:center;
}

.user-edit-back{
    position:absolute;
    left:0;
    top:0;
    z-index:2;
    min-height:40px;
    padding:0 12px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:6px;
    border-radius:12px;
    border:1px solid #20466e;
    background:#10253d;
    color:#dff3ff;
    text-decoration:none;
    font-size:12px;
    font-weight:800;
}

.user-edit-back:hover{
    filter:brightness(1.12);
}

.user-edit-avatar{
    display:grid;
    place-items:center;
    border-radius:14px;
    background:#103255;
    border:1px solid #235b8c;
    color:#dff7ff;
    font-size:18px;
    font-weight:850;
}

.user-edit-card{
    width:100%;
    max-width:620px;
    margin:0 auto;
}

.password-field{
    position:relative;
}

.password-field input{
    padding-right:52px;
}

.password-toggle{
    position:absolute;
    right:8px;
    top:50%;
    transform:translateY(-50%);
    width:38px;
    height:38px;
    border:1px solid #20466e;
    border-radius:11px;
    background:#10253d;
    color:#9fc4df;
    display:grid;
    place-items:center;
    cursor:pointer;
}

.password-toggle:hover,
.password-toggle.is-visible{
    color:#54e5ff;
    border-color:#2b84c7;
}

.password-eye svg{
    width:19px;
    height:19px;
    fill:none;
    stroke:currentColor;
    stroke-width:1.8;
    stroke-linecap:round;
    stroke-linejoin:round;
}

.password-current{
    display:flex;
    flex-direction:column;
    gap:6px;
    padding:13px 14px;
    border-radius:14px;
    border:1px solid #1c3c61;
    background:#06101d;
}

.password-current span{
    letter-spacing:.16em;
    color:#dcefff;
    font-weight:800;
}

.password-current small,
.field-help{
    color:var(--muted);
    font-size:10px;
    line-height:1.45;
}

.user-edit-status{
    display:flex;
    align-items:center;
    gap:10px;
    margin:4px 0 16px;
    padding:11px 12px;
    border:1px solid #14654e;
    border-radius:14px;
    background:#09291f;
    color:#9ff5d5;
}

.user-edit-status-inactive{
    border-color:#6f541c;
    background:#2b2110;
    color:#ffd89a;
}

.user-edit-status-dot{
    width:9px;
    height:9px;
    flex:0 0 9px;
    border-radius:50%;
    background:currentColor;
    box-shadow:0 0 12px currentColor;
}

.user-edit-status strong,
.user-edit-status small{
    display:block;
}

.user-edit-status small{
    margin-top:2px;
    color:inherit;
    opacity:.75;
    font-size:10px;
}

.user-edit-buttons{
    margin-top:4px;
}

/* =========================================================
   REVISÃO FINAL — RESPONSIVO
========================================================= */

@media(max-width:699px){

    .history-page-title{
        margin-top:2px;
    }

    .history-page-title h2{
        font-size:19px;
    }

    .history-filter-grid{
        grid-template-columns:1fr 1fr;
    }

    .history-summary{
        grid-template-columns:1fr 1fr;
    }

    .history-summary .card:last-child{
        grid-column:1 / -1;
    }

    .history-toolbar{
        align-items:stretch;
    }

    .history-row{
        align-items:flex-start;
        padding:12px;
    }

    .history-row-main{
        align-items:flex-start;
    }

    .history-row-side{
        flex-direction:column;
        align-items:flex-end;
        gap:6px;
    }

    .history-row-actions{
        justify-content:flex-end;
    }

    .history-row-icon{
        width:34px;
        height:34px;
        flex-basis:34px;
    }

    .history-row-title{
        font-size:13px;
    }

    .history-row-meta{
        font-size:10px;
    }

    .history-row-value{
        font-size:13px;
    }

    .history-action-btn{
        width:34px;
        height:34px;
    }

    .user-edit-heading{
        grid-template-columns:40px minmax(0,1fr) 40px;
        margin-bottom:18px;
    }

    .user-edit-heading > div:nth-child(2){
        width:42px;
        height:42px;
    }

    .user-edit-heading > div:last-child{
        margin-top:54px;
    }

    .user-edit-heading h2{
        font-size:20px;
    }

    .user-edit-back{
        min-height:38px;
        padding:0 10px;
        font-size:11px;
    }

    .user-edit-card{
        max-width:none;
    }
}

@media(max-width:380px){

    .history-filter-grid{
        grid-template-columns:1fr;
    }

    .history-summary{
        grid-template-columns:1fr 1fr;
        gap:8px;
    }

    .history-row{
        gap:8px;
        padding:10px;
    }

    .history-row-main{
        gap:8px;
    }

    .history-row-icon{
        width:31px;
        height:31px;
        flex-basis:31px;
        border-radius:10px;
        font-size:12px;
    }

    .history-row-title{
        font-size:12px;
    }

    .history-row-meta{
        font-size:9px;
    }

    .history-row-value{
        font-size:12px;
    }

    .history-action-btn{
        width:32px;
        height:32px;
        border-radius:10px;
    }

    .user-edit-heading{
        grid-template-columns:36px minmax(0,1fr) 36px;
    }

    .user-edit-heading > div:nth-child(2){
        width:40px;
        height:40px;
    }

    .user-edit-back{
        padding:0 8px;
    }
}

/* =========================================================
   CORREÇÃO FINAL — CARDS HISTÓRICO / TÉCNICOS / NOVO TÉCNICO
   Complemento sem remover nenhuma regra anterior.
========================================================= */

.history-filter-card,
.history-search-card{
    display:block;
    width:100%;
    position:relative;
    z-index:1;
}

.history-search-form{
    display:flex;
    align-items:center;
    gap:10px;
    width:100%;
}

.search-input-wrap{
    position:relative;
    flex:1;
    min-width:0;
}

.history-search-input{
    width:100%;
    min-height:46px;
    padding:0 14px 0 42px;
    border:1px solid #1c3c61;
    border-radius:14px;
    background:#06101d;
    color:#fff;
    font:inherit;
    outline:none;
}

.history-search-input:focus{
    border-color:#39a9ff;
    box-shadow:0 0 0 3px rgba(52,167,255,.12);
}

.search-icon{
    position:absolute;
    left:14px;
    top:50%;
    transform:translateY(-50%);
    color:var(--muted);
    font-size:20px;
    pointer-events:none;
}

.history-list{
    display:flex;
    flex-direction:column;
    gap:10px;
}

.history-item{
    width:100%;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:14px;
    min-width:0;
    padding:14px;
    border:1px solid #183552;
    border-radius:18px;
    background:linear-gradient(145deg,rgba(13,27,49,.96),rgba(7,16,29,.99));
    box-shadow:0 10px 30px rgba(0,0,0,.16);
}

.history-item:hover{
    border-color:#24577f;
}

.history-item-cancelled{
    opacity:.56;
}

.history-item-main{
    min-width:0;
    flex:1;
}

.history-item-title{
    display:flex;
    align-items:center;
    gap:7px;
    min-width:0;
    font-weight:800;
    font-size:14px;
}

.history-item-meta{
    margin-top:5px;
    color:var(--muted);
    font-size:11px;
    line-height:1.4;
}

.history-cancelled-label{
    margin-top:6px;
    color:#ffb8cb;
    font-size:10px;
}

.history-item-right{
    display:flex;
    flex-direction:column;
    align-items:flex-end;
    gap:6px;
    flex-shrink:0;
}

.history-item-value{
    font-weight:850;
    white-space:nowrap;
    font-size:15px;
}

.history-item-commission{
    color:var(--muted);
    font-size:10px;
    white-space:nowrap;
}

.history-actions{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:6px;
}

.history-action-form{
    margin:0;
    padding:0;
}

.history-action-btn{
    width:36px;
    height:36px;
    padding:0;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border-radius:11px;
    border:1px solid #20466e;
    background:#10253d;
    color:#dff3ff;
    text-decoration:none;
    font:inherit;
    cursor:pointer;
}

.history-action-trash,
.history-action-delete{
    border-color:#754052;
    background:#321824;
    color:#ffc1d1;
}

.history-action-restore{
    border-color:#14654e;
    background:#09291f;
    color:#9ff5d5;
}

.history-action-btn:hover{
    filter:brightness(1.14);
}

.empty-state{
    text-align:center;
    padding:24px 16px;
}

.users-list{
    width:100%;
    display:flex;
    flex-direction:column;
    gap:10px;
}

.user-card{
    position:relative;
    z-index:1;
    width:100%;
    min-height:76px;
    overflow:hidden;
}

.user-actions{
    position:relative;
    z-index:3;
}

.user-actions a,
.user-actions button{
    pointer-events:auto;
}

.users-new-btn{
    position:relative;
    z-index:5;
    pointer-events:auto;
    white-space:nowrap;
}

.user-edit-page{
    position:relative;
    z-index:1;
    width:100%;
}

.user-edit-heading{
    position:relative;
    z-index:2;
}

.user-edit-back,
.user-edit-heading a,
.user-edit-page a,
.user-edit-page button{
    pointer-events:auto;
}

.user-edit-card{
    position:relative;
    z-index:2;
    width:100%;
}

.user-edit-card form{
    width:100%;
}

@media(max-width:699px){
    .history-search-form{
        flex-direction:column;
        align-items:stretch;
    }

    .history-search-form .btn{
        width:100%;
    }

    .history-item{
        align-items:flex-start;
        padding:12px;
    }

    .history-item-right{
        align-items:flex-end;
    }

    .history-item-title{
        font-size:13px;
    }

    .history-item-meta{
        font-size:10px;
    }

    .history-item-value{
        font-size:13px;
    }

    .history-action-btn{
        width:34px;
        height:34px;
    }

    .users-new-btn{
        display:flex;
        width:100%;
        justify-content:center;
    }

    .user-card{
        align-items:flex-start;
    }

    .user-actions{
        flex-wrap:wrap;
        justify-content:flex-end;
    }
}

@media(max-width:430px){
    .history-item{
        gap:9px;
    }

    .history-item-right{
        max-width:112px;
    }

    .history-item-value{
        font-size:12px;
    }

    .history-item-commission{
        font-size:9px;
    }

    .user-info{
        gap:9px;
    }

    .user-avatar{
        width:40px;
        height:40px;
        flex-basis:40px;
    }

    .user-name{
        font-size:14px;
    }

    .user-email{
        font-size:10px;
    }

    .user-actions{
        gap:5px;
    }
}


/* =========================================================
   HISTÓRICO — AJUSTES DE LAYOUT E IDENTIFICAÇÃO
   ========================================================= */

.history-kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.history-kpis .card {
    min-width: 0;
    padding: 10px;
}

.history-kpis .small {
    display: block;
    min-height: 28px;
    line-height: 1.2;
}

.history-kpis .kpi {
    margin-top: 5px;
    font-size: 17px;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Navegação de data */
.history-date-navigation {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    margin: 12px 0;
    padding: 8px 0;
}

.date-nav-btn {
    width: 48px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 48px;
    border-radius: 12px;
    border: 1px solid #1b4c79;
    background: #0b192a;
    color: #e8f7ff;
    font-size: 27px;
    font-weight: 800;
    text-decoration: none;
    line-height: 1;
}

.date-nav-btn:hover {
    background: #10243b;
}

.date-nav-btn.disabled {
    opacity: .32;
    pointer-events: none;
}

.date-nav-current {
    min-width: 120px;
    text-align: center;
    font-size: 16px;
    font-weight: 800;
    color: #f0f8ff;
}

/* Pesquisa */
.history-search-card {
    margin-bottom: 10px;
}

.history-search-form {
    display: block;
}

.history-search-form .search-input-wrap {
    width: 100%;
}

.history-search-input {
    width: 100%;
}

/* Filtros suspensos */
.history-filter-dropdown {
    margin-bottom: 14px;
}

.history-filter-toggle {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 1px solid #1b4c79;
    border-radius: 12px;
    background: #0b192a;
    color: #e8f7ff;
    cursor: pointer;
    font: inherit;
}

.history-filter-toggle:hover,
.history-filter-toggle.is-open {
    background: #10243b;
}

.history-filter-chevron {
    transition: transform .2s ease;
}

.history-filter-toggle.is-open .history-filter-chevron {
    transform: rotate(180deg);
}

.history-filter-panel {
    margin-top: 8px;
    padding: 12px;
    border: 1px solid #142e4b;
    border-radius: 16px;
    background: #081321;
}

.history-filter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.seller-history .history-filter-panel[hidden] { display: none; }
.seller-history .history-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seller-history .history-filter-panel:not([hidden]) { animation: seller-history-reveal .2s ease-out; }
@keyframes seller-history-reveal {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.seller-history-hint, .seller-history-context { color: #9bb3c9; font-size: 13px; line-height: 1.5; }
.seller-history-context { text-align: center; margin: 8px 0; }
.seller-history-filter-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.seller-history-filter-actions .btn { flex: 1; text-align: center; }
.seller-history .history-date-navigation { display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; gap: 12px; max-width: 420px; margin: 12px auto; }
.seller-history .date-nav-current { min-width: 0; overflow-wrap: anywhere; }
.seller-history .history-item-value.seller-history-sale-value { color: #fff; }
.seller-history .history-item-commission { color: #36d99c; font-size: 12px; }
@media (prefers-reduced-motion: reduce) {
    .seller-history .history-filter-panel:not([hidden]) { animation: none; }
}

.history-filter-panel .field {
    min-width: 0;
}

.history-filter-panel input,
.history-filter-panel select {
    width: 100%;
    min-width: 0;
}

/* Cores dos lançamentos — somente conteúdo, nunca os botões */
.history-item {
    position: relative;
}

.history-item-main,
.history-item-right {
    position: relative;
    z-index: 1;
}

.history-type-store .history-item-title,
.history-type-store .history-item-meta,
.history-type-store .history-item-value {
    color: #ff5b68;
}

.history-type-personal .history-item-title,
.history-type-personal .history-item-meta,
.history-type-personal .history-item-value {
    color: #ffd45a;
}

.history-type-service .history-item-title,
.history-type-service .history-item-meta,
.history-type-service .history-item-value {
    color: #55a9ff;
}

.history-type-accessory .history-item-title,
.history-type-accessory .history-item-meta,
.history-type-accessory .history-item-value {
    color: #58d68d;
}

/* Comissão continua neutra/legível */
.history-item-commission {
    color: #9bb3c9;
}

/* Botões continuam com aparência própria e legível */
.history-actions .history-action-btn {
    color: #e8f7ff;
    background: #0b192a;
}

.history-actions .history-action-edit {
    color: #e8f7ff;
}

.history-actions .history-action-trash {
    color: #ff9daa;
}

.history-actions .history-action-restore {
    color: #8ee7ff;
}

.history-actions .history-action-delete {
    color: #ff8f9f;
}

/* Histórico: leitura mais confortável sem alterar as cores por tipo de lançamento. */
.history-item-title {
    font-size: 16px;
}

.history-item-meta {
    font-size: 12px;
    line-height: 1.5;
}

.history-item-value {
    font-size: 17px;
}

.history-item-commission {
    font-size: 12px;
}

.history-cancelled-label {
    font-size: 11px;
}

/* Mantém o lançamento apagado visualmente separado, sem apagar as ações disponíveis. */
.history-item-cancelled {
    opacity: 1;
}

.history-item-cancelled .history-item-main,
.history-item-cancelled .history-item-value,
.history-item-cancelled .history-item-commission {
    opacity: .56;
}

.history-item-cancelled .history-actions {
    opacity: 1;
}

.history-item-cancelled .history-action-btn {
    box-shadow: 0 0 0 1px currentColor, 0 5px 14px rgba(0,0,0,.22);
}

/* Detalhamento de peças a pagar no histórico. */
.history-cost-card {
    width: 100%;
    display: block;
    appearance: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.history-cost-card:hover,
.history-cost-card:focus-visible {
    border-color: #2a6d9d;
    box-shadow: 0 0 0 3px rgba(57,169,255,.14), 0 12px 35px rgba(0,0,0,.17);
    outline: none;
}

.history-cost-modal[hidden] {
    display: none;
}

.history-cost-modal {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 18px;
}

.history-cost-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    border: 0;
    background: rgba(1,6,14,.74);
    cursor: default;
}

.history-cost-dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 560px);
    max-height: min(78vh, 620px);
    overflow: auto;
    border: 1px solid #23527c;
    border-radius: 20px;
    background: #091624;
    box-shadow: 0 24px 70px rgba(0,0,0,.52);
}

.history-cost-dialog-header,
.history-cost-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px;
}

.history-cost-dialog-header {
    border-bottom: 1px solid #173653;
}

.history-cost-dialog-header h2 {
    margin: 0;
    font-size: 18px;
}

.history-cost-dialog-header p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.history-cost-close {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border: 1px solid #2b5a80;
    border-radius: 11px;
    background: #10253d;
    color: #e8f7ff;
    font: inherit;
    font-size: 25px;
    line-height: 1;
    cursor: pointer;
}

.history-cost-list {
    padding: 8px 16px;
}

.history-cost-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(29,66,96,.75);
}

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

.history-cost-row-main {
    min-width: 0;
}

.history-cost-row-main strong,
.history-cost-row-main span {
    display: block;
}

.history-cost-row-main strong {
    font-size: 15px;
}

.history-cost-row-main span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.history-cost-row-value {
    flex: 0 0 auto;
    color: #ffb7c3;
    font-size: 16px;
    font-weight: 800;
    white-space: nowrap;
}

.history-cost-empty {
    padding: 18px 0;
    color: var(--muted);
    text-align: center;
}

.history-cost-total {
    border-top: 1px solid #23527c;
    color: #d9efff;
}

.history-cost-total strong {
    color: #ffb7c3;
    font-size: 17px;
}

body.history-modal-open {
    overflow: hidden;
}

/* Edição de venda. */
.sale-edit-topbar {
    display: flex;
    align-items: center;
    min-height: 40px;
    margin: 4px 0 14px;
}

.sale-edit-back {
    min-height: 40px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid #20466e;
    border-radius: 12px;
    background: #10253d;
    color: #dff3ff;
    text-decoration: none;
    font-size: 12px;
    font-weight: 800;
}

.sale-edit-back:hover,
.sale-edit-back:focus-visible {
    filter: brightness(1.12);
    outline: none;
}

.sale-cost-input {
    color: #ff8794;
    font-weight: 800;
}

@media (max-width: 699px) {
    .history-cost-modal {
        align-items: end;
        padding: 10px;
    }

    .history-cost-dialog {
        max-height: 82vh;
        border-radius: 18px;
    }
}

/* Desktop */
@media (min-width: 700px) {
    .history-kpis {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Celular: mantém exatamente 3 colunas para ocupar menos espaço */
@media (max-width: 699px) {
    .history-kpis {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }

    .history-kpis .card {
        padding: 8px;
        border-radius: 12px;
    }

    .history-kpis .small {
        font-size: 9px;
        min-height: 25px;
    }

    .history-kpis .kpi {
        font-size: 14px;
    }

    .history-date-navigation {
        gap: 22px;
        margin: 10px 0;
    }

    .date-nav-btn {
        width: 46px;
        height: 40px;
        flex-basis: 46px;
        font-size: 25px;
    }

    .date-nav-current {
        min-width: 105px;
        font-size: 15px;
    }

    .history-filter-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

@media (max-width: 380px) {
    .history-kpis {
        gap: 5px;
    }

    .history-kpis .card {
        padding: 7px 6px;
    }

    .history-kpis .small {
        font-size: 8px;
    }

    .history-kpis .kpi {
        font-size: 12px;
    }

    .history-date-navigation {
        gap: 18px;
    }

    .date-nav-btn {
        width: 42px;
        height: 38px;
        flex-basis: 42px;
    }
}

/* Técnicos: saldo líquido na lista e edição sem ícone decorativo. */
.user-balance {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 108px;
    padding-right: 2px;
    text-align: right;
}

.user-balance span {
    color: var(--muted);
    font-size: 10px;
}

.user-balance strong {
    margin-top: 3px;
    font-size: 13px;
    white-space: nowrap;
}

.user-edit-heading {
    display: block;
    min-height: 66px;
    margin: 4px 0 16px;
    padding-top: 48px;
}

.user-edit-heading > div,
.user-edit-heading > div:last-child {
    width: 100%;
    height: auto;
    margin: 0;
    text-align: center;
}

.user-edit-toggle-active {
    border-color: #14654e;
    background: #09291f;
    color: #9ff5d5;
}

.user-edit-toggle-inactive {
    border-color: #6f541c;
    background: #2b2110;
    color: #ffd89a;
}

/* Campos editáveis de técnico: não são inputs de login e, portanto,
   não recebem preenchimento automático das credenciais do administrador. */
.user-edit-textbox {
    width: 100%;
    min-height: 44px;
    padding: 12px 13px;
    border: 1px solid #26415e;
    border-radius: 10px;
    background: #07111f;
    color: #e8f1fb;
    font: inherit;
    line-height: 1.35;
    overflow-wrap: anywhere;
    outline: none;
}

.user-edit-textbox:focus {
    border-color: #39a9ff;
    box-shadow: 0 0 0 3px rgba(57,169,255,.14);
}

.user-edit-textbox:empty::before {
    content: attr(data-placeholder);
    color: #71829a;
    pointer-events: none;
}

@media (max-width: 699px) {
    .user-card {
        flex-wrap: wrap;
    }

    .user-info {
        flex-basis: 100%;
    }

    .user-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .user-balance {
        min-width: 84px;
    }

    .user-balance span {
        font-size: 9px;
    }

    .user-balance strong {
        font-size: 11px;
    }

    .user-edit-heading {
        min-height: 64px;
        margin-bottom: 16px;
    }
}
