/* Mobile First Base Styles */
#dbpnl-app { font-family: 'Segoe UI', sans-serif; width: 100%; max-width: 1400px; margin: 0 auto; color: #333; box-sizing: border-box; }
#dbpnl-app * { box-sizing: border-box; }

.dbpnl-controls { background: #fff; padding: 15px; border-radius: 8px; display: flex; flex-direction: column; gap: 15px; margin-bottom: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.control-group { display: flex; width: 100%; gap: 10px; }
.control-group input, .control-group select { flex-grow: 1; padding: 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 5px; width: 100%; }
.quick-actions button { flex: 1 0 30%; background: #f0f0f1; border: 1px solid #ccc; padding: 8px; border-radius: 4px; font-size: 13px; cursor: pointer; }
.button-primary { background: #2271b1; color: #fff; border: none; padding: 10px 15px; border-radius: 4px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.edit-btn { background: #2c3338; color: #fff; border: none; padding: 10px; border-radius: 4px; width: 100%; margin-top: 5px; cursor: pointer; }

/* View Toggle Buttons */
.view-toggle .tab-btn { background: transparent; border: none; padding: 10px 15px; font-weight: 600; color: #555; cursor: pointer; border-bottom: 3px solid transparent; }
.view-toggle .tab-btn.active { color: #2271b1; border-bottom-color: #2271b1; background: #f0f6fc; border-radius: 4px 4px 0 0; }

/* Grid Layouts */
.metrics-grid, .details-grid, .team-cards { display: grid; grid-template-columns: 1fr; gap: 15px; margin-bottom: 20px; }

/* Cards */
.card { padding: 20px; border-radius: 8px; color: #fff; position: relative; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.card h2 { margin: 5px 0; font-size: 28px; font-weight: 600; color:#fff; }
.card small { opacity: 0.9; font-size: 12px; display: block; margin-top: 5px; }
.blue { background: linear-gradient(135deg, #3498db, #2980b9); } 
.red { background: linear-gradient(135deg, #e74c3c, #c0392b); } 
.orange { background: linear-gradient(135deg, #f39c12, #d35400); } 
.green { background: linear-gradient(135deg, #2ecc71, #27ae60); }
.purple { background: linear-gradient(135deg, #9b59b6, #8e44ad); }

/* Panels */
.panel { background: #fff; padding: 15px; border: 1px solid #e5e5e5; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.panel h3 { margin-top: 0; border-bottom: 2px solid #f0f0f0; padding-bottom: 10px; font-size: 16px; color: #444; }
.row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed #eee; font-size: 14px; }
.row:last-child { border-bottom: none; }
.red-text { color: #e74c3c; } 
.sub-row { padding-left: 15px; font-size: 13px; color: #555; border-bottom: none; }
.total { font-weight: bold; border-top: 2px solid #eee; margin-top: 5px; padding-top: 10px; font-size: 16px; }
.large { font-size: 18px; color: #2c3e50; }

/* Team Cards */
.team-card { border: 1px solid #e0e0e0; padding: 15px; border-radius: 6px; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.team-card h4 { margin: 0 0 10px; border-bottom: 1px solid #f0f0f0; padding-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.badge { font-size: 11px; padding: 2px 6px; border-radius: 3px; font-weight: normal; text-transform: uppercase; }
.regular-card { border-top: 3px solid #3498db; } .regular-card .badge { background: #eaf4fb; color: #3498db; }
.agent-card { border-top: 3px solid #9b59b6; } .agent-card .badge { background: #f5eef8; color: #9b59b6; }

/* Payment Manager Table Styles */
.pay-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
.pay-table thead tr { background: #f8f9fa; border-bottom: 2px solid #e9ecef; }
.pay-table th { padding: 12px; text-align: left; color: #495057; font-weight: 600; text-transform: uppercase; font-size: 12px; }
.pay-table td { padding: 12px; border-bottom: 1px solid #eee; color: #333; vertical-align: middle; }
.pay-table tr:hover { background-color: #f8f9fa; }
.pay-btn { background: #27ae60; color: #fff; border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: 600; transition: background 0.2s; margin-right: 5px; }
.pay-btn:hover { background: #219150; }
.hist-btn { background: #3498db; color: #fff; border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 12px; margin-right: 5px; }
.hist-btn:hover { background: #2980b9; }
.edit-pay { background: #f39c12; color: #fff; border: none; padding: 4px 8px; border-radius: 3px; cursor: pointer; margin-right: 5px; }
.delete-pay { background: #e74c3c; color: #fff; border: none; padding: 4px 8px; border-radius: 3px; cursor: pointer; }
.green-text { color: #27ae60; font-weight: bold; }

/* Modal */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 9999; }
.modal-content { background: #fff; width: 95%; max-width: 500px; margin: 5% auto; padding: 20px; border-radius: 8px; position: relative; max-height: 90vh; overflow-y: auto; box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
.close-modal, .close-modal-pay, .close-modal-hist { position: absolute; right: 15px; top: 15px; font-size: 24px; cursor: pointer; color: #999; line-height: 1; }
.modal-header { display: flex; gap: 10px; margin-bottom: 15px; }
.input-row { margin-bottom: 10px; } .input-row label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 13px; } .input-row input { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; }
.large-btn { width: 100%; padding: 10px; font-size: 16px; margin-top: 10px; }
.modal-tabs { display: flex; overflow-x: auto; border-bottom: 1px solid #ddd; margin-bottom: 15px; }
.mtab-btn { background: none; border: none; padding: 10px 15px; cursor: pointer; border-bottom: 2px solid transparent; font-weight: 600; color: #666; white-space: nowrap; }
.mtab-btn.active { border-bottom: 2px solid #2271b1; color: #2271b1; background: #f0f6fc; }
.mtab-content { display: none; } .mtab-content.active { display: block; }

/* Responsive */
@media screen and (min-width: 768px) {
    .metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .details-grid { grid-template-columns: 1fr 1fr; }
    .team-cards { grid-template-columns: repeat(2, 1fr); }
    .dbpnl-controls { flex-direction: row; justify-content: space-between; align-items: center; }
    .control-group { width: auto; }
    .quick-actions { width: auto; }
    .quick-actions button { flex: none; }
    .edit-btn { width: auto; margin-top: 0; }
    .full-width { grid-column: span 2; }
}

@media screen and (min-width: 1024px) {
    .metrics-grid { grid-template-columns: repeat(5, 1fr); }
    .details-grid { grid-template-columns: 1fr 1fr 1fr; } 
    .team-cards { grid-template-columns: repeat(4, 1fr); }
    .full-width { grid-column: span 3; }
}