:root {
    --navy: #0c1728;
    --navy-2: #111f33;
    --navy-3: #172a43;
    --bg: #f3f6fa;
    --card: #ffffff;
    --line: #e4e9f0;
    --text: #172033;
    --muted: #6d788a;
    --blue: #2f6fed;
    --green: #11875d;
    --green-bg: #e9f7f1;
    --amber: #b96a08;
    --amber-bg: #fff4df;
    --red: #c43d45;
    --red-bg: #fff0f1;
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

button,
a {
    font: inherit;
}

.app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 254px 1fr;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 254px;
    background:
        linear-gradient(
            180deg,
            var(--navy),
            #091321
        );
    color: #dce4ef;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #17283c;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 4px 6px 22px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #ffffff;
    color: var(--navy);
    font-size: 20px;
    font-weight: 900;
    display: grid;
    place-items: center;
}

.brand strong,
.brand span {
    display: block;
}

.brand strong {
    color: white;
    font-size: 15px;
    letter-spacing: .03em;
}

.brand span {
    margin-top: 3px;
    font-size: 9px;
    letter-spacing: .12em;
    color: #8796aa;
}

.environment {
    margin: 0 4px 20px;
    padding: 9px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .08);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
}

.environment-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 7px;
    border-radius: 50%;
    background: #e9a633;
}

.menu {
    overflow-y: auto;
}

.menu a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 12px;
    margin: 3px 0;
    border-radius: 8px;
    color: #aebbc9;
    text-decoration: none;
    font-size: 13px;
    transition: .15s ease;
}

.menu a:hover,
.menu a.active {
    color: white;
    background: var(--navy-3);
}

.menu a.active {
    box-shadow:
        inset 3px 0 0 var(--blue);
}

.menu a span {
    width: 20px;
    text-align: center;
    font-size: 15px;
}

.menu-label {
    padding: 18px 12px 6px;
    color: #65758a;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .13em;
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid #1b2b3d;
    padding: 18px 6px 0;
}

.sidebar-footer small,
.sidebar-footer strong,
.sidebar-footer span {
    display: block;
}

.sidebar-footer small {
    color: #65758a;
}

.sidebar-footer strong {
    margin-top: 3px;
    color: white;
}

.sidebar-footer span {
    margin-top: 4px;
    color: #d18b8f;
    font-size: 11px;
}

.main {
    grid-column: 2;
    min-width: 0;
}

.topbar {
    min-height: 86px;
    padding: 17px 32px;
    background: white;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.eyebrow,
.section-label {
    margin: 0 0 3px;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .12em;
    color: #8090a4;
}

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

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

.avatar {
    width: 38px;
    height: 38px;
    margin-left: 5px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: white;
    background: var(--navy-2);
    font-size: 11px;
    font-weight: 900;
}

.content {
    max-width: 1480px;
    margin: 0 auto;
    padding: 28px 32px 50px;
}

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

.welcome-label {
    display: inline-block;
    margin-bottom: 6px;
    color: var(--blue);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .11em;
}

.welcome h2 {
    margin: 0;
    font-size: 26px;
}

.welcome p {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.primary-button,
.secondary-button,
.ghost-button {
    border: 0;
    border-radius: 8px;
    padding: 11px 16px;
    font-weight: 800;
}

.primary-button {
    background: var(--blue);
    color: white;
}

.secondary-button {
    width: 100%;
    color: var(--text);
    background: #eef2f7;
}

.ghost-button {
    background: transparent;
    color: var(--blue);
}

button:disabled {
    opacity: .58;
    cursor: not-allowed;
}

.kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.kpi,
.card,
.mini-card {
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: 0 3px 12px rgba(19, 33, 54, .035);
}

.kpi {
    min-height: 104px;
    border-radius: 12px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    color: var(--blue);
    background: #edf3ff;
    font-weight: 900;
}

.kpi-icon.success {
    color: var(--green);
    background: var(--green-bg);
}

.kpi-icon.warning {
    color: var(--amber);
    background: var(--amber-bg);
}

.kpi-icon.neutral {
    color: #57677c;
    background: #edf0f4;
}

.kpi span,
.kpi small {
    display: block;
}

.kpi span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.kpi strong {
    display: block;
    margin: 2px 0;
    font-size: 25px;
}

.kpi small {
    color: #95a0ae;
    font-size: 10px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 2.1fr) minmax(270px, .9fr);
    gap: 16px;
    margin-bottom: 16px;
}

.card {
    border-radius: var(--radius);
    padding: 22px;
}

.card-heading {
    min-height: 43px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 18px;
}

.card-heading h3 {
    margin: 0;
    font-size: 16px;
}

.badge,
.pill {
    display: inline-flex;
    align-items: center;
    border-radius: 99px;
    font-size: 9px;
    font-weight: 900;
    white-space: nowrap;
}

.badge {
    padding: 5px 8px;
}

.pill {
    padding: 7px 10px;
}

.badge-ok {
    color: var(--green);
    background: var(--green-bg);
}

.badge-warning,
.pill-warning {
    color: var(--amber);
    background: var(--amber-bg);
}

.badge-danger,
.pill-danger {
    color: var(--red);
    background: var(--red-bg);
}

.badge-neutral {
    color: #627085;
    background: #eef1f5;
}

.states {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.state-card {
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: 16px;
}

.state-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.uf {
    width: 37px;
    height: 37px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--navy-2);
    color: white;
    font-size: 11px;
    font-weight: 900;
}

.state-card h4 {
    margin: 13px 0 4px;
}

.state-card p {
    min-height: 32px;
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.state-meta {
    padding: 8px 0;
    display: flex;
    justify-content: space-between;
    border-top: 1px solid #edf0f4;
    font-size: 10px;
}

.state-meta span {
    color: var(--muted);
}

.environment-card {
    padding: 14px;
    margin-bottom: 10px;
    border-radius: 9px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.environment-card span,
.environment-card strong {
    display: block;
}

.environment-card span {
    font-size: 9px;
    font-weight: 900;
}

.environment-card strong {
    margin-top: 2px;
    font-size: 12px;
}

.environment-card b {
    font-size: 9px;
}

.env-hml {
    background: var(--amber-bg);
    color: #83540c;
}

.env-prod {
    background: var(--red-bg);
    color: #9e333a;
}

.security-note {
    margin: 15px 2px 0;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
}

.flow {
    border-top: 1px solid var(--line);
}

.flow-row {
    min-height: 62px;
    display: grid;
    grid-template-columns: 32px 1fr auto;
    gap: 12px;
    align-items: center;
    border-bottom: 1px solid var(--line);
}

.flow-index {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #66758a;
    background: #f0f3f7;
    font-size: 10px;
    font-weight: 900;
}

.flow-info strong,
.flow-info span {
    display: block;
}

.flow-info strong {
    font-size: 12px;
}

.flow-info span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.empty-icon {
    width: 58px;
    height: 58px;
    margin: 16px auto;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #718096;
    background: #f0f3f7;
}

.center {
    text-align: center;
}

.muted {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

th {
    padding: 10px;
    text-align: left;
    color: #7b8797;
    background: #f8fafc;
    font-size: 9px;
    letter-spacing: .05em;
}

td {
    padding: 13px 10px;
    border-top: 1px solid var(--line);
}

.table-empty {
    padding: 18px;
    text-align: center;
    color: #929cab;
}

.mini-grid {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.mini-card {
    border-radius: 11px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 11px;
}

.mini-card > span {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: var(--blue);
    background: #eef4ff;
    font-size: 11px;
    font-weight: 900;
}

.mini-card strong,
.mini-card small {
    display: block;
}

.mini-card strong {
    font-size: 11px;
}

.mini-card small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 9px;
}

.footer-info {
    margin-top: 18px;
    padding: 15px 2px;
    display: flex;
    justify-content: space-between;
    color: #8792a2;
    font-size: 10px;
}

.footer-info strong {
    color: #59677a;
}

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

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .mini-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 760px) {
    .app {
        display: block;
    }

    .sidebar {
        position: relative;
        width: 100%;
        min-height: auto;
    }

    .sidebar-footer {
        display: none;
    }

    .main {
        width: 100%;
    }

    .topbar,
    .content {
        padding-left: 18px;
        padding-right: 18px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .top-actions {
        flex-wrap: wrap;
    }

    .welcome {
        align-items: flex-start;
        flex-direction: column;
    }

    .kpis,
    .states,
    .mini-grid {
        grid-template-columns: 1fr;
    }

    .footer-info {
        gap: 7px;
        flex-direction: column;
    }
}

/* ==========================================================
   FTECH_FISCAL_SIDEBAR_SCROLL_V1
   Scroll da sidebar inteira, sem scrollbar visual interna
   ========================================================== */
@media (min-width: 901px) {

    .sidebar {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .sidebar::-webkit-scrollbar {
        width: 0;
        height: 0;
        display: none;
    }

    .menu {
        overflow-y: visible !important;
        overflow-x: visible !important;
        max-height: none !important;
        flex: none !important;
    }
}
