:root {
    --bg-gradient-start: #0B1220;
    --bg-gradient-end: #0F172A;
    --card-bg: rgba(255, 255, 255, 0.04);
    --card-border: 1px solid rgba(255, 255, 255, 0.08);
    --text-primary: #F3F4F6;
    --text-secondary: rgba(243, 244, 246, 0.7);
    --accent-gold: #D4AF37;
    --accent-blue: #3B82F6;
    --accent-green: #22C55E;
    --accent-red: #EF4444;
    --accent-cyan: #06B6D4;
    --font-main: 'Inter', sans-serif;
}

body {
    background: linear-gradient(180deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: var(--text-primary);
    font-family: var(--font-main);
    margin: 0;
    padding: 15px 25px;
    /* Compact padding */
    height: 100vh;
    overflow-y: auto;
    /* Allow vertical scroll */
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* --- BRANDING --- */
/* --- BRANDING & HEADER --- */
.orbyx-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    margin-bottom: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

/* Centralização para página de pedidos */
.orbyx-header--centered {
    justify-content: center !important;
    gap: 50px;
}

.orbyx-header--centered .brand-section,
.orbyx-header--centered .header-center,
.orbyx-header--centered .header-right {
    flex: initial;
    width: auto;
    justify-content: center;
}

.orbyx-header--centered .header-right {
    gap: 15px;
}

.orbyx-header--centered .brand-info {
    align-items: center;
    text-align: center;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.brand-logo-link {
    display: block;
    line-height: 0;
}

/* Logo image hidden as user prefers text logo with gradient */
.orbyx-logo-img {
    display: none;
}

.brand-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.1;
}

.brand-main-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--text-primary);
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.brand-client {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
}

.brand-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(to right, #BF953F, #FCF6BA, #B38728, #FBF5B7, #AA771C);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-transform: uppercase;
    line-height: 1.1;
    display: flex;
    align-items: center;
}

.brand-subtitle {
    font-family: 'Orbitron', sans-serif;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 1px;
    background: linear-gradient(to right, #D7D7D7, #FFFFFF, #A0A0A0, #E0E0E0);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-transform: uppercase;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.version-tag {
    font-size: 10px;
    color: var(--accent-gold);
    border: 1px solid rgba(212, 175, 55, 0.3);
    padding: 1px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    font-style: normal;
    font-weight: 700;
}

.brand-client {
    font-size: 10px;
    /* Bem pequeno para não brigar com o logo */
    color: #dbb64a;
    /* Amarelo discreto / Muted Gold */
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-top: 4px;
    margin-left: 0;
    opacity: 0.8;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    display: block;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 15px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #4B5563;
}

.status-dot.ok {
    background-color: var(--accent-green);
    box-shadow: 0 0 5px var(--accent-green);
}

.status-dot.error {
    background-color: var(--accent-red);
}

/* --- GRID LAYOUT --- */
.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
    overflow-y: auto;
    padding: 5px 0 20px 0;
}

/* Generic Row Style */
.metric-row {
    display: grid;
    gap: 15px;
    width: 100%;
}

/* Configurations */
.row-revenue {
    grid-template-columns: repeat(3, 1fr);
}

.row-receivables {
    grid-template-columns: repeat(5, 1fr);
}

.row-payables {
    grid-template-columns: repeat(5, 1fr);
}

.row-strategic {
    grid-template-columns: 1.2fr 1fr 1.2fr;
}

/* --- CARDS --- */
.kpi-card {
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.05) 0%,
            rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px 20px;
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden !important;
    min-height: 90px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.kpi-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: transparent;
    transition: background 0.3s;
}

.kpi-card:hover {
    background: rgba(255, 255, 255, 0.07);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.15);
}

.card-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1.5px;
    margin-bottom: 8px;
    font-weight: 700;
}

.card-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

/* --- HIERARCHY SIZES --- */
.kpi-xl .card-value {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 4px;
}

.card-subtitle {
    font-size: 14px;
    font-weight: 600;
    color: #94a3b8;
    /* Slate 400 */
    opacity: 0.9;
}

.kpi-lg .card-value {
    font-size: 30px;
    font-weight: 800;
}

.kpi-md .card-value {
    font-size: 24px;
    font-weight: 700;
}

/* Special Destaque for Net Result */
.destaque-card {
    border: 1px solid rgba(212, 175, 55, 0.35) !important;
    background: rgba(212, 175, 55, 0.05) !important;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.4),
        inset 0 0 20px rgba(212, 175, 55, 0.04);
}

.destaque-card .card-label {
    font-size: 11px;
    margin-bottom: 8px;
}

/* --- DYNAMIC COLORS --- */
.val-positive {
    color: #22C55E !important;
}

.val-negative {
    color: #EF4444 !important;
}

.val-neutral {
    color: #F3F4F6 !important;
}

/* --- COLOR THEMES --- */
/* Revenue - White (Executive Clean) */
.theme-revenue .card-value {
    color: var(--text-primary);
}

.theme-revenue .card-label {
    color: var(--text-secondary);
    /* Neutral gray/white */
}

/* Faturamento Mes - White (Maintain MD hierarchy) */
.theme-revenue-month .card-value {
    color: var(--text-primary);
    font-weight: 700;
}

.theme-revenue-month .card-label {
    color: var(--text-secondary);
}

/* Receivables - Green with glow */
.theme-receivables .card-value {
    color: var(--accent-green);
    text-shadow: 0 0 18px rgba(34, 197, 94, 0.35);
}

.theme-receivables .card-label {
    color: rgba(34, 197, 94, 0.8);
}

/* Payables - Red with glow */
.theme-payables .card-value {
    color: var(--accent-red);
    text-shadow: 0 0 18px rgba(239, 68, 68, 0.35);
}

.theme-payables .card-label {
    color: rgba(239, 68, 68, 0.8);
}

/* Net Result — Golden strategic highlight */
.theme-net .card-value {
    font-size: 42px !important;
    font-weight: 800 !important;
}

.theme-net .card-label {
    color: rgba(212, 175, 55, 0.85);
    font-weight: 700;
}

/* Balance - Cyan */
.theme-balance .card-value {
    color: #29B6F6;
    /* Definitivo Cyan */
}

.theme-balance .card-label {
    color: rgba(41, 182, 246, 0.8);
}

/* --- RESPONSIVE — DESKTOP LARGE --- */
@media (max-width: 1600px) {
    .kpi-xl .card-value {
        font-size: 32px;
    }

    .kpi-lg .card-value {
        font-size: 26px;
    }

    .card-value {
        font-size: 22px;
    }
}

/* --- RESPONSIVE — TABLET (max 1024px) --- */
@media (max-width: 1024px) {
    body {
        padding: 10px 15px;
    }

    .row-receivables,
    .row-payables {
        grid-template-columns: repeat(3, 1fr);
    }

    .kpi-xl .card-value {
        font-size: 30px;
    }
}

/* --- RESPONSIVE — MOBILE (max 768px) --- */
@media (max-width: 768px) {
    body {
        padding: 10px;
        height: auto;
    }

    .orbyx-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 15px;
        padding-bottom: 20px;
    }

    .orbyx-header--centered {
        gap: 10px !important;
    }

    .brand-title {
        font-size: 22px;
        justify-content: center;
    }

    .brand-subtitle {
        font-size: 11px;
        justify-content: center;
    }

    .header-center {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    .header-right {
        width: 100%;
        justify-content: center;
        font-size: 11px;
        padding: 6px 10px;
    }

    .row-revenue,
    .row-receivables,
    .row-payables {
        grid-template-columns: repeat(2, 1fr);
    }

    .row-strategic {
        grid-template-columns: 1fr;
    }

    .kpi-card {
        padding: 12px 15px;
        min-height: 80px;
    }

    .card-value {
        font-size: 22px;
    }

    .kpi-xl .card-value {
        font-size: 26px;
    }
}

/* --- RESPONSIVE — SMALL MOBILE (max 480px) --- */
@media (max-width: 480px) {

    .row-revenue,
    .row-receivables,
    .row-payables {
        grid-template-columns: 1fr;
    }

    .btn-primary-header {
        width: 100%;
        justify-content: center;
    }

    .brand-title {
        font-size: 18px;
        letter-spacing: 1.5px;
    }

    .brand-subtitle {
        font-size: 10px;
        letter-spacing: 0.5px;
    }

    .brand-client {
        font-size: 9px;
    }

    .orbyx-header--centered {
        gap: 5px !important;
    }

    .orbyx-header--centered .brand-info {
        margin-bottom: 5px;
    }
}

@media (max-height: 850px) {
    .dashboard-grid {
        gap: 10px;
    }

    .metric-row {
        gap: 10px;
    }

    .kpi-card {
        padding: 15px 20px;
        min-height: 90px;
    }
}


/* --- INTERACTIVITY --- */
.clickable {
    cursor: pointer !important;
}

.kpi-card.clickable:hover,
.matrix-card.clickable:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.2);
    z-index: 10;
}

.modal-content.modal-lg {
    max-width: 800px;
}

.badge-condition {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--accent-light);
}

.txt-right {
    text-align: right;
}

/* --- MODAL ORBYX (V1.2-DEV LAB) --- */
.orbyx-modal {
    display: none;
    /* Escondido por padrão */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.orbyx-modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    padding: 30px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.orbyx-modal.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.btn-close:hover {
    color: var(--accent-red);
}

.modal-body {
    overflow-y: auto;
    flex: 1;
    padding-right: 10px;
}

/* Custom Scrollbar */
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.details-table {
    width: 100%;
    border-collapse: collapse;
}

.details-table th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.details-table td {
    padding: 14px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.95rem;
}

.details-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.txt-right {
    text-align: right;
}

.modal-footer {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: right;
}

.total-label {
    font-size: 1.1rem;
    font-weight: 700;
}

#modal-total-val {
    color: var(--accent-red);
    margin-left: 10px;
}

/* --- BRUSHED INDUSTRIAL METAL BUTTONS --- */
.btn-edit,
.btn-baixa,
.btn-excluir {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 8px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 10px 22px;
    font-size: 11px;
    text-transform: uppercase;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    position: relative;
    user-select: none;
    box-sizing: border-box;
    color: #ffffff !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
    border: none;

    /* Stronger, more diffuse Industrial Shadow */
    box-shadow:
        0 10px 28px rgba(0, 0, 0, 0.80),
        inset 0 1px 4px rgba(255, 255, 255, 0.20),
        inset 0 -5px 10px rgba(0, 0, 0, 0.55);
}

/* Noise/grain overlay for brushed metal texture */
.btn-edit::after,
.btn-baixa::after,
.btn-excluir::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: 1;
}

/* EDITAR — Azul Metálico Profundo */
.btn-edit {
    background-image:
        linear-gradient(to bottom, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.04) 30%, rgba(0, 0, 0, 0.35) 100%),
        linear-gradient(to bottom, #2c5fb8, #0f2e6d);
}

/* BAIXAR — Verde Corporativo Forte */
.btn-baixa {
    background-image:
        linear-gradient(to bottom, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.04) 30%, rgba(0, 0, 0, 0.35) 100%),
        linear-gradient(to bottom, #0f7a42, #074d27);
}

/* EXCLUIR — Vermelho Profundo */
.btn-excluir {
    background-image:
        linear-gradient(to bottom, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.04) 30%, rgba(0, 0, 0, 0.35) 100%),
        linear-gradient(to bottom, #a02121, #5a0f0f);
}

/* Hover: Button Rises */
.btn-edit:hover,
.btn-baixa:hover,
.btn-excluir:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.75);
}

/* Active: Button Presses In */
.btn-edit:active,
.btn-baixa:active,
.btn-excluir:active {
    transform: translateY(3px);
    box-shadow:
        inset 0 5px 12px rgba(0, 0, 0, 0.7);
}

.btn-edit i,
.btn-baixa i,
.btn-excluir i {
    font-size: 14px;
}

/* --- FINANCIAL MATRIX (V4.0) --- */
.matrix-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 5px;
}

.matrix-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.matrix-header {
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    font-weight: 800;
    color: var(--accent-gold);
    text-align: center;
    padding: 10px;
    border-bottom: 2px solid rgba(212, 175, 55, 0.3);
    margin-bottom: 15px;
    letter-spacing: 3px;
    text-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
}

.matrix-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all 0.2s ease;
    backdrop-filter: blur(12px);
    min-height: 85px;
}

.matrix-card.clickable {
    cursor: pointer;
}

.matrix-card.clickable:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(8px);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.matrix-label {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 1.5px;
    opacity: 0.8;
}

.matrix-value {
    font-size: 24px;
    font-weight: 800;
    font-family: 'Inter', sans-serif;
    line-height: 1;
}

/* Specific Colors (User Request) */
.theme-receivables .matrix-value {
    color: #22C55E !important;
    /* Vivid Green */
}

.theme-receivables .matrix-label {
    color: rgba(34, 197, 94, 0.9);
}

.theme-payables .matrix-value {
    color: #EF4444 !important;
    /* Vivid Red */
}

.theme-payables .matrix-label {
    color: rgba(239, 68, 68, 0.9);
}

/* Matrix Total / Results */
.matrix-total {
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.07);
    border: 2px solid rgba(212, 175, 55, 0.4);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.matrix-total .matrix-value {
    font-size: 30px;
    font-weight: 900;
}

/* Theme specifics for Matrix */
.theme-projected .matrix-label {
    color: var(--accent-gold);
    opacity: 1;
}

/* Desktop Responsive Matrix */
@media (max-width: 1400px) {
    .matrix-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
}

@media (max-width: 768px) {
    .matrix-container {
        grid-template-columns: 1fr;
    }

    .row-revenue {
        flex-direction: column;
        gap: 15px;
    }

    .kpi-xl .card-value {
        font-size: 28px !important;
    }

    .matrix-value {
        font-size: 20px !important;
    }

    .matrix-total .matrix-value {
        font-size: 24px !important;
    }
}

@media (max-width: 480px) {
    .kpi-xl .card-value {
        font-size: 24px !important;
    }

    .card-subtitle {
        font-size: 12px;
    }
}

.actions-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    padding: 10px 0;
}