.permuta-v4-scope {
    --primary: #00796b;
    --primary-hover: #00695c;
    --primary-light: #e0f2f1;
    --text-main: #333;
    --text-muted: #777;
    --bg-app: #f4f7f6;
    --border: #ddd;
    --white: #ffffff;
    --positive: #00796b;
    --negative: #d32f2f;
    --info: #0288d1;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    color: var(--text-main);
    background: var(--bg-app);
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
    padding: 0;
    overflow-x: hidden;
}

.permuta-v4-scope * { 
    box-sizing: border-box; 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* All Buttons Verde Petróleo + 6px Rounded */
.permuta-v4-scope .btn-main,
.permuta-v4-scope .btn-include,
.permuta-v4-scope .btn-save-entry,
.permuta-v4-scope #btn-login,
.permuta-v4-scope #btn-register,
.permuta-v4-scope #btn-recover-1,
.permuta-v4-scope #btn-recover-2 {
    background: var(--primary) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-weight: 700 !important;
    padding: 12px !important;
}

/* Button Relatório & Period Select - Styled like v7.0 */
.permuta-v4-scope .btn-report, .permuta-v4-scope .period-select {
    background: #fff !important;
    border: 1px solid var(--border) !important;
    padding: 8px 15px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 13px !important;
    color: #555 !important;
    font-weight: 500 !important;
}

/* Auth Section Centralized */
.permuta-v4-scope .auth-container {
    display: flex; align-items: center; justify-content: center; min-height: 100vh;
    background: var(--primary); padding: 20px; width: 100%;
}
.permuta-v4-scope .auth-box {
    background: var(--white); padding: 40px; border-radius: 12px; width: 100%; max-width: 400px;
    text-align: center;
}
.permuta-v4-scope .auth-box input {
    width: 100%; padding: 12px; margin-bottom: 15px; border: 1px solid var(--border); border-radius: 6px;
    text-align: center;
}

/* App Header */
.permuta-v4-scope .app-header {
    background: var(--white); padding: 12px 25px; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center; width: 100%;
}
.permuta-v4-scope .header-left h1 { font-size: 18px; margin: 0; font-weight: 700; }
.permuta-v4-scope .btn-top-outline {
    background: var(--white); border: 1px solid var(--border); padding: 8px 14px; border-radius: 6px;
    cursor: pointer; font-size: 13px; color: #555;
}

/* App Shell - 3 Column Grid */
.permuta-v4-scope .app-shell {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    width: 100%;
    min-height: calc(100vh - 60px);
}

/* Sidebars - Unified Look */
.permuta-v4-scope .sidebar-left, .permuta-v4-scope .sidebar-right {
    background: #fff; padding: 25px 20px; overflow-y: auto;
}
.permuta-v4-scope .sidebar-left { border-right: 1px solid var(--border); }
.permuta-v4-scope .sidebar-right { border-left: 1px solid var(--border); }

.permuta-v4-scope .section-title { font-size: 14px; font-weight: 700; color: #333; margin-bottom: 15px; }

/* Inputs in Sidebars */
.permuta-v4-scope input, .permuta-v4-scope select, .permuta-v4-scope textarea {
    width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
}

.permuta-v4-scope .partner-item {
    display: flex; justify-content: space-between; align-items: center; padding: 14px 12px;
    border-radius: 6px; cursor: pointer; margin-bottom: 8px; background: #fff;
}
.permuta-v4-scope .partner-item.active { background: #e0f2f1; border-left: 4px solid var(--primary); }

/* Main Content */
.permuta-v4-scope .main-content { padding: 35px; overflow-y: auto; min-width: 0; }
.permuta-v4-scope .partner-top-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 30px; }

/* Dashboard Cards - Colored like v7.0 */
.permuta-v4-scope .dashboard-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 25px; margin-bottom: 40px; }
.permuta-v4-scope .dash-card { background: #fff; padding: 25px; border-radius: 12px; border: 1px solid #eee; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
.permuta-v4-scope .dash-label { font-size: 11px; font-weight: 700; color: #888; margin-bottom: 12px; text-transform: uppercase; }
.permuta-v4-scope .dash-value { font-size: 28px; font-weight: 800; margin-bottom: 8px; }

.permuta-v4-scope .positive { color: var(--positive); }
.permuta-v4-scope .negative { color: #e65100; } /* Orange for debits like v7.0 */
.permuta-v4-scope .info { color: #0277bd; } /* Blue for balance like v7.0 */

/* Pure Icons Action - No Background */
.permuta-v4-scope .btn-tbl { 
    background: transparent !important; border: none !important; 
    padding: 5px; cursor: pointer; color: #999; font-size: 16px;
}
.permuta-v4-scope .btn-tbl:hover { color: var(--primary); }

/* Right Panel Buttons */
.permuta-v4-scope .type-buttons { display: flex; gap: 12px; margin-bottom: 20px; }
.permuta-v4-scope .btn-type {
    flex: 1; padding: 12px; border: 1px solid var(--border); border-radius: 6px; background: #fff;
    cursor: pointer; font-weight: 700; font-size: 13px;
}
.permuta-v4-scope .btn-type.active[onclick*="credit"] { border-color: var(--positive); color: var(--positive); background: #e0f2f1; }
.permuta-v4-scope .btn-type.active[onclick*="debit"] { border-color: var(--negative); color: var(--negative); background: #fbe9e7; }

.permuta-v4-scope .btn-cancel {
    width: 100%; background: #fff; border: 1px solid #eee; padding: 10px; border-radius: 6px;
    cursor: pointer; font-size: 13px; color: #999; margin-top: 10px;
}

.permuta-v4-scope .form-footer { margin-top: 20px; font-size: 10px; color: #bbb; text-align: center; }

@media print {
    .permuta-v4-scope .no-print { display: none !important; }
    .permuta-v4-scope .app-header { display: none !important; }
    .permuta-v4-scope .app-shell { display: block !important; }
    .permuta-v4-scope .main-content { padding: 0 !important; width: 100% !important; }
    .permuta-v4-scope .dashboard-grid { grid-template-columns: repeat(3, 1fr) !important; }
}
