/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; }

body {
    background: #2b2b2b;
    color: #d4d4d4;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

/* ─── Typography ─── */
h1 { color: #aaa; font-size: 1.8rem; margin: .5rem 0; }
h2 { color: #bbb; font-size: 1.4rem; margin: .5rem 0; }
h3 { color: #999; font-size: 1.2rem; margin: .4rem 0; }
h4 { color: #888; font-size: 1rem;   margin: .3rem 0; }
h5 { color: #777; font-size: .9rem;  margin: .3rem 0; }

a:link, a:visited { color: #c0c0c0; text-decoration: none; }
a:hover { color: #fff; text-decoration: underline; }

/* ─── Forms ─── */
form input, form select, form textarea {
    color: #222;
    background: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 8px 10px;
    font-size: 14px;
    transition: border-color .2s;
}
form input:focus, form select:focus, form textarea:focus {
    border-color: #7ab;
    outline: none;
    background: #fff;
}
form label { display: block; color: #aaa; font-size: 13px; margin-bottom: 2px; }

/* ─── Buttons ─── */
button, .button, input[type="submit"] {
    display: inline-block;
    background: #444;
    color: #ddd;
    border: 1px solid #666;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    min-height: 40px;
    min-width: 44px;
    transition: background .2s, border-color .2s;
    text-decoration: none;
}
button:hover, .button:hover, input[type="submit"]:hover {
    background: #555;
    border-color: #888;
    color: #fff;
}
.button2 {
    display: inline-block;
    background: #3a3a3a;
    color: #ccc;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 9px 11px;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.button2:hover { background: #4a4a4a; color: #fff; }

/* ─── Navigation ─── */
.nav {
    background: #1e1e1e;
    border-bottom: 1px solid #3a3a3a;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.nav-row { padding: 0; }
.nav-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    flex-wrap: nowrap;
}

/* Logo */
.logo { display: flex; align-items: center; flex-shrink: 0; }
.logo img { width: 40px; height: 40px; border-radius: 6px; }

/* Hamburger */
.menu-btn {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
    gap: 2px;
    color: #999;
    border-radius: 4px;
}
.menu-btn:hover { background: #2e2e2e; }
.menu-label { font-size: 11px; font-weight: bold; color: #999; margin-top: 2px; }
.bar1, .bar2, .bar3 {
    width: 37px;
    height: 3px;
    background: #999;
    border-radius: 2px;
    transition: .3s;
}
.menu-btn.open .bar1 { transform: rotate(-45deg) translate(-5px, 5px); margin-left: 8px; margin-top: -2px; }
.menu-btn.open .bar2 { opacity: 0; }
.menu-btn.open .bar3 { transform: rotate(45deg) translate(-4px, -5px); margin-left: 8px; margin-top: 3px; }

/* Nav icons */
.nav-icons {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
}
.iconNav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: #888;
    border-radius: 4px;
    transition: background .2s, color .2s;
    text-decoration: none;
}
.iconNav:hover { background: #2e2e2e; color: #fff; text-decoration: none; }

/* Nav Menu (dropdown) */
.navMenu {
    display: none;
    background: #1a1a1a;
    border-top: 1px solid #333;
}
.navMenu.open { display: block; }
.navMenu nav {
    padding: 8px 0;
    display: flex;
    flex-direction: column;
}
.nav-section { padding: 4px 0; }
.nav-section h4 {
    color: #888;
    padding: 6px 16px 4px;
    margin: 0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
    border-top: 1px solid #2a2a2a;
}
.nav-section:first-child h4 { border-top: none; }
.navMenu a {
    display: block;
    color: #ccc;
    padding: 10px 16px 10px 28px;
    font-size: 14px;
    border-bottom: 1px solid #242424;
    transition: background .15s, color .15s;
}
.navMenu a:hover { background: #252525; color: #fff; text-decoration: none; }

/* ─── Main body ─── */
.body { min-height: 400px; padding: 12px 0; }

/* ─── Footer ─── */
.footer {
    margin-top: 40px;
    padding: 10px 0;
    background: #1e1e1e;
    color: #888;
    font-size: 12px;
    border-top: 1px solid #333;
    text-align: center;
}
.footer a { color: #888; }
.footer a:hover { color: #bbb; }

/* ─── Panels ─── */
.inicioPainel {
    padding: 8px 12px 12px;
    margin-bottom: 12px;
    border-radius: 6px;
    background: #333;
    border: 1px solid #444;
}
.formPainel {
    padding: 14px;
    border-radius: 6px;
    background: #333;
    border: 1px solid #444;
    margin-bottom: 14px;
}

/* ─── Alerts ─── */
.alertSucesso, .alertErro, .alertAlerta {
    padding: 10px 14px;
    border-radius: 5px;
    margin-bottom: 12px;
    font-size: 14px;
}
.alertSucesso { background: #1a4a1a; border: 1px solid #2d7a2d; color: #8ee08e; }
.alertErro    { background: #4a1a1a; border: 1px solid #7a2d2d; color: #e08e8e; }
.alertAlerta  { background: #3a3a00; border: 1px solid #666600; color: #e0e08e; }

.listaSucesso { background: #1a4a1a !important; }
.listaErro    { background: #5a1a1a !important; }
.listaAlerta  { background: #3a3a00 !important; }
.listaAndamento { background: #1a3a5a !important; }
.listaPecas   { background: #3a2a00 !important; }
.listaRetirar { background: #2a1a4a !important; }
.listaTerceiros { background: #1a3a3a !important; }

/* ─── Color labels ─── */
.tituloReceita  { color: #4caf50; }
.tituloDespesa  { color: #ef6c00; }
.tituloAlerta   { color: #f9a825; }
.tituloLaranja  { color: #ff9800; }

/* ─── Tables (div-based) ─── */
.thead, .tbody {
    border-bottom: 1px solid #3c3c3c;
    padding: 6px 4px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}
.thead { font-weight: 600; color: #aaa; background: #2a2a2a; border-radius: 4px 4px 0 0; }
.tbody { transition: background .15s; }
.tbody:hover { background: #2e2e2e; }
.thead a, .tbody a { color: #c8c8c8; }
.tbody a:hover { color: #fff; }

/* ─── Utility ─── */
.textCenter { text-align: center; }
.textRight  { text-align: right; }
.floatRight { float: right; }
.topoBtn    { text-align: right; margin-bottom: 8px; }
.topoBtn a  { color: #888; }

.limitador0 { height: 100px; overflow: auto; }
.limitador1 { height: 150px; overflow: auto; }
.limitador2 { height: 250px; overflow: auto; }
.limitador3 { height: 350px; overflow: auto; }

/* ─── Login page ─── */
#login {
    max-width: 380px;
    margin: 8% auto 0;
    padding: 0 16px;
    text-align: center;
}
#login h1 { margin-bottom: 16px; }
#login h2 { color: #777; margin-bottom: 24px; }
#loginForm input {
    width: 100%;
    margin-bottom: 12px;
    padding: 12px 14px;
    font-size: 16px;
}
#loginForm input[type="submit"] {
    background: #3a5a3a;
    color: #8ee08e;
    border-color: #4a7a4a;
    width: 100%;
    font-size: 16px;
    padding: 12px;
}
#loginForm input[type="submit"]:hover { background: #4a7a4a; }

/* ─── Toggle buttons (client active/inactive) ─── */
.btn-toggle { font-weight: 600; letter-spacing: .02em; }
.btn-ativo  { background: #1e4a1e; border-color: #2d7a2d; color: #8ee08e; }
.btn-ativo:hover  { background: #2d6a2d; color: #aef0ae; }
.btn-inativo { background: #4a1a1a; border-color: #7a2d2d; color: #e08e8e; }
.btn-inativo:hover { background: #6a2a2a; color: #f0aeae; }

/* ─── Token / inicio ─── */
#chaveToken   { display: none; }
.inicioToken a { display: block; text-align: center; color: #ccc; padding: 8px 0; }

/* ─── Visibility helpers (mobile vs desktop) ─── */
.vM { display: inline; }
.vD { display: none;   }

/* ─── Responsive: tablet and up ─── */
@media (min-width: 600px) {
    .navMenu nav {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 8px 16px;
        gap: 0 24px;
    }
    .nav-section h4 { border-top: none; padding-top: 8px; }
    .navMenu a { padding: 8px 12px 8px 0; border-bottom: none; font-size: 13px; }
    .navMenu a:hover { background: none; text-decoration: underline; }
    .body { min-height: 470px; }
}

@media (min-width: 750px) {
    /* Slide-in side panel on wider screens */
    #navMenu {
        position: absolute;
        left: 0;
        top: 100%;
        min-width: 280px;
        border: 1px solid #333;
        border-top: none;
        box-shadow: 4px 4px 12px rgba(0,0,0,.5);
        border-radius: 0 0 6px 6px;
    }
    .navMenu nav { flex-direction: column; padding: 0; }
    .navMenu a { padding: 10px 16px 10px 28px; border-bottom: 1px solid #242424; font-size: 14px; }

    .footer  { text-align: left; }
    .footer .ordepweb { text-align: right; }

    .vM { display: none; }
    .vD { display: block; }

    /* Stacked label columns in forms look better side-by-side */
    .formPainel .row { align-items: flex-start; }
}

@media (min-width: 1000px) {
    body { font-size: 15px; }
    .nav { position: sticky; top: 0; }
}

/* ─── Table scrollable on mobile ─── */
@media (max-width: 549px) {
    /* Give list rows a card-like look on small screens */
    .thead { display: none; }
    .tbody {
        display: block;
        padding: 10px 10px;
        margin-bottom: 6px;
        border: 1px solid #3c3c3c;
        border-radius: 5px;
    }
    .tbody > div[class*=" columns"],
    .tbody > div[class^="columns"],
    .tbody > div[class*="columns"] {
        width: 100% !important;
        display: block;
        padding: 2px 0;
    }
    /* Form fields full-width on mobile */
    .formPainel input,
    .formPainel select,
    .formPainel textarea {
        width: 100% !important;
        margin-bottom: 8px;
    }
    /* Buttons side by side still */
    .formPainel button, .formPainel .button { margin-bottom: 8px; }
}
