body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background: #f8f9fa;
    color: #212529;
    min-height: 100vh;
}

/* --- Login Page --- */
.login-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
}
.login-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 1.5rem;
}
.login-form {
    background: #ffffff;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    width: 350px;
    text-align: center;
    border: 1px solid #e9ecef;
}
.login-form h1 {
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    color: #212529;
    font-weight: 600;
}
.login-form input {
    width: 100%;
    padding: 0.875rem;
    margin-bottom: 1rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-sizing: border-box;
    transition: all 0.3s ease;
    background: #ffffff;
    color: #212529;
    font-size: 0.95rem;
}
.login-form input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
    background: #ffffff;
}
.login-form button {
    width: 100%;
    padding: 0.875rem;
    border: none;
    border-radius: 8px;
    background: #f8f9fa;
    color: #212529;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}
.login-form button:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}
.version-info {
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: #6c757d;
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}
.shake {
    animation: shake 0.5s ease-in-out;
}

/* --- Main Layout --- */
.main-layout {
    display: flex;
    height: 100vh;
    overflow: hidden; /* Prevent body scroll */
}
.sidebar {
    width: 280px;
    min-width: 280px;
    max-width: 280px;
    background: #ffffff;
    color: #212529;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    flex-shrink: 0;
    z-index: 100;
    border-right: 1px solid #e9ecef;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
}
.sidebar-collapsed {
    width: 0;
    min-width: 0;
    max-width: 0;
    padding: 0;
    border-right: none;
    overflow: visible;
}
.sidebar-collapsed > *:not(.sidebar-toggle) {
    display: none;
}
.sidebar-header {
    text-align: center;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 1.5rem;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-header h1 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    color: #212529;
}
.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
    white-space: nowrap;
    overflow-x: hidden; /* Hide text overflow */
}
.sidebar-menu li {
    padding: 0.875rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    color: #495057;
    font-weight: 500;
    margin-bottom: 0.5rem;
}
.sidebar-menu li:hover {
    background: #f8f9fa;
    color: #212529;
}
.sidebar-footer {
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    margin-top: auto;
}
.logout-button {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 4px;
    background-color: #6c757d;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
}
.logout-button:hover {
    background-color: #5a6268;
}
.sidebar-toggle {
    position: absolute;
    top: 1rem;
    right: 0.5rem;
    width: 24px;
    height: 24px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    line-height: 1;
    z-index: 101;
    transition: all 0.3s ease;
}
.sidebar-collapsed .sidebar-toggle {
    right: -24px;
    border-radius: 0 8px 8px 0;
    width: 24px;
    height: 48px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}
.content-area {
    flex-grow: 1;
    padding: 2rem;
    overflow-y: auto;
    transition: margin-left 0.3s ease;
    width: 100%;
    background: #f8f9fa;
}

/* --- KPI Cards --- */
.kpi-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}
.kpi-card {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    flex-grow: 1;
    text-align: center;
    min-width: 200px;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}
.kpi-card h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    color: #6c757d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.kpi-card p {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: #212529;
}

/* --- Chart Containers --- */
.charts-row-container {
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap; /* Allow wrapping on small screens */
}
.pie-chart-container {
    width: 100%;
    max-width: 450px;
    flex: 1 1 300px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
    border: 1px solid #e9ecef;
}
.bar-chart-container {
    width: 100%;
    margin: 0 auto;
    padding-bottom: 2rem;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
    border: 1px solid #e9ecef;
}

/* --- Table Wrapper (enables horizontal scroll without breaking layout) --- */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
    border: 1px solid #e9ecef;
    background: #ffffff;
}

/* --- Table Styles --- */
.data-table {
    width: 100%;
    min-width: 1000px;
    border-collapse: collapse;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
}
.data-table th, .data-table td {
    padding: 0.45rem 0.5rem;
    text-align: right;
    border-bottom: 1px solid #f0f2f5;
    vertical-align: middle;
    color: #1a1f2e;
    white-space: nowrap;
    font-size: 0.9rem;
}
/* First 3 cols (name / category / location) left-aligned */
.data-table th:nth-child(-n+3),
.data-table td:nth-child(-n+3) {
    text-align: left;
}
/* Last col (actions) centered */
.data-table th:last-child,
.data-table td:last-child {
    text-align: center;
}
.data-table th {
    background: #f7f8fa;
    color: #6b7280;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-size: 0.775rem;
    border-bottom: 2px solid #e9ecef;
    position: sticky;
    top: 0;
    z-index: 1;
}
/* Numeric columns — monospace for clean alignment */
.data-table td.num {
    font-family: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: -0.1px;
}
/* Highlight the primary identifier (NAME) column */
.data-table td:nth-child(1) {
    font-weight: 600;
    color: #111827;
    font-size: 0.95rem;
}
.data-table tbody tr {
    transition: background 0.15s ease;
}
.data-table tbody tr:hover {
    background: #f5f7fa;
}
/* Profit row highlight */
.data-table tbody tr.row-profit {
    background-color: rgba(67, 196, 165, 0.07);
}
.data-table tbody tr.row-profit:hover {
    background-color: rgba(67, 196, 165, 0.14);
}
/* Loss row highlight */
.data-table tbody tr.row-loss {
    background-color: rgba(220, 53, 69, 0.05);
}
.data-table tbody tr.row-loss:hover {
    background-color: rgba(220, 53, 69, 0.1);
}
/* Closed Deal Row Style */
.data-table tbody tr.closed-deal-row {
    background-color: #f8f9fa;
}
.data-table tbody tr.closed-deal-row td {
    color: #b0b8c4;
}
.data-table tbody tr.closed-deal-row:hover {
    background-color: #eff1f4;
}

.location-badge {
    display: inline-block;
    padding: 0.25em 0.6em;
    margin-left: 0.5rem;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
    color: #fff;
    background-color: #6c757d;
}
.action-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    border: 1px solid #e2e6ea;
    background: #f7f8fa;
    color: #374151;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-right: 0.3rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
}
.action-btn:last-child {
    margin-right: 0;
}
.action-btn:hover {
    background: #e9ecef;
    border-color: #ced4da;
    color: #1a1f2e;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

/* P/L Text Colors */
.pl-positive {
    color: #0f8a6e;
    font-weight: 700;
    background: rgba(67, 196, 165, 0.13);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    display: inline-block;
    white-space: nowrap;
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 0.925rem;
    letter-spacing: -0.2px;
    min-width: 75px;
    text-align: center;
}
.pl-negative {
    color: #b91c1c;
    font-weight: 700;
    background: rgba(220, 53, 69, 0.1);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    display: inline-block;
    white-space: nowrap;
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 0.925rem;
    letter-spacing: -0.2px;
    min-width: 75px;
    text-align: center;
}
td.num.pl-positive, td.num.pl-negative {
    min-width: 110px;
}

/* Text Colors */
.text-positive {
    color: #0f8a6e !important;
}
.text-negative {
    color: #b91c1c !important;
}

/* --- Pagination Styles --- */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}
.pagination-button {
    padding: 0.5rem 1rem;
    border: 1px solid #6c757d;
    background-color: white;
    color: #6c757d;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}
.pagination-button:hover {
    background-color: #6c757d;
    color: white;
}
.pagination-button:disabled {
    background-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    border-color: #ced4da;
}
.page-info {
    font-size: 0.9rem;
    color: #6c757d;
}

/* --- Investment Goals Styles --- */
.add-goal-btn {
    background-color: #f8f9fa;
    color: #212529;
    border-color: #e9ecef;
    margin-bottom: 1.5rem;
    padding: 0.5rem 1rem;
    font-size: 1rem;
}
.add-goal-btn:hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.goals-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    gap: 1.5rem;
}

.goal-item-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: opacity 0.3s ease;
}
.goal-item-card.completed-goal {
    opacity: 0.65;
}
.goal-item-card.completed-goal .action-btn:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

.goal-item-card h3 {
    margin: 0;
    font-size: 1.25rem;
}
.goal-description {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    flex-grow: 1;
}

.progress-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.progress-section .progress-bar-container {
    flex-grow: 1;
    margin-bottom: 0;
}
.progress-bar-container {
    width: 100%;
    background-color: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}
.progress-bar {
    height: 20px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.5s ease-in-out;
}
.goal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: auto;
}
.edit-btn {
    border-color: #007bff;
    color: #007bff;
}
.edit-btn:hover {
    background-color: #007bff;
    color: white;
}
.delete-btn {
    border-color: #E57373;
    color: #E57373;
}
.delete-btn:hover {
    background-color: #E57373;
    color: white;
}

/* --- Goal Form Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal-content {
    background: #ffffff;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid #e9ecef;
}
.modal-content h2 {
    margin-top: 0;
    color: #212529;
    font-weight: 600;
}
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #212529;
    font-size: 0.9rem;
}
.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 0.875rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-sizing: border-box;
    background: #ffffff;
    color: #212529;
    transition: all 0.3s ease;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
    background: #ffffff;
}
.save-btn {
    background: #f8f9fa;
    color: #212529;
    border-color: #e9ecef;
    transition: all 0.3s ease;
}
.save-btn:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}
.cancel-btn {
    background: rgba(107, 114, 128, 0.8);
    color: white;
    border-color: rgba(107, 114, 128, 0.8);
}
.cancel-btn:hover {
    background: rgba(75, 85, 99, 0.9);
    transform: translateY(-1px);
}
.error-message {
    color: #dc3545;
    background-color: #f8d7da;
    border: 1px solid #f5c2c7;
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

/* --- New Goal Card Styles --- */
.goal-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}
.status-badge {
    padding: 0.25em 0.6em;
    font-size: 0.75em;
    font-weight: 700;
    border-radius: 0.375rem;
    color: white;
    text-transform: uppercase;
}
.status-active { background-color: #dc3545; }
.status-completed { background-color: #48C9B0; }
.status-default { background-color: #6c757d; }

.goal-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
    border-top: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 0;
}
.stat-block {
    display: flex;
    flex-direction: column;
}
.stat-label {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
}
.stat-value {
    font-size: 1.1rem;
    font-weight: 600;
}
.text-primary {
    color: #007bff;
}
.stat-date-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.date-value {
    font-size: 0.9rem;
    font-weight: 500;
}
.date-arrow {
    color: #6c757d;
}
.goal-stats-grid .stat-block:nth-child(3) {
    grid-column: 1 / -1;
}

/* Pace Indicator Styles */
.pace-indicator {
    font-size: 1.2rem;
    cursor: help;
}
.pace-on-track { background-color: #007bff; }
.pace-at-risk { background-color: #F5A623; }
.pace-off-track { background-color: #E57373; }
.pace-indicator.pace-at-risk { color: #F5A623; }
.pace-indicator.pace-off-track { color: #E57373; }

/* Form Checkbox Alignment */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.form-check input {
    width: auto;
    margin-bottom: 0;
}
.form-check label {
    margin-bottom: 0;
    font-weight: normal;
}

/* Custom Properties List */
.custom-properties-list {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
}
.property-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e9ecef;
}
.property-item:last-child {
    border-bottom: none;
}
.property-key {
    font-weight: 600;
    color: #495057;
}
.property-value {
    color: #212529;
}

/* Currency Converter Widget */
.currency-converter-widget {
    background: #ffffff;
    border: 1px solid #e9ecef;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-top: 2rem;
}
.currency-converter-widget h3 {
    margin-top: 0;
}
.converter-inputs {
    display: flex;
    align-items: flex-end; /* Align items to the bottom */
    gap: 1rem;
    margin-bottom: 1rem;
}
.converter-inputs .form-group {
    margin-bottom: 0; /* Remove default margin */
}
.converter-input-field {
    flex: 2;
}
.converter-select-field {
    flex: 1;
}
.converter-swap-icon {
    font-size: 1.5rem;
    color: #6c757d;
    padding-bottom: 0.75rem; /* Align with form fields */
}
.converter-result {
    font-size: 1.8rem;
    font-weight: 600;
    color: #212529;
    text-align: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}
.converter-inputs .form-group label {
    /* Visually hide labels but keep them for accessibility */
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- Loading Spinner --- */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 9999;
}

.loading-spinner-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    animation: spin 2s linear infinite;
    transform-origin: center;
}

.loading-spinner-logo-inner {
    width: 100%;
    height: 100%;
    background: #007bff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 24px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.loading-spinner-text {
    color: #212529;
    font-size: 16px;
    margin: 0;
    animation: pulse 1.5s ease-in-out infinite;
}

/* Investment Calculator Widget */
.investment-calculator-widget {
    background: #ffffff;
    border: 1px solid #e9ecef;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-top: 2rem;
}

.investment-calculator-widget h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: #212529;
    font-weight: 600;
}

.calculator-inputs {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.period-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.calculator-results {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e9ecef;
}

.result-row:last-child {
    border-bottom: none;
}

.result-label {
    font-weight: 600;
    color: #6c757d;
}

.result-value {
    font-weight: 600;
    color: #212529;
    font-size: 1.1rem;
}

.profit-positive {
    color: #198754 !important;
}

.profit-negative {
    color: #dc3545 !important;
}

/* Chart Styles */
.chart-container {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
    margin-top: 2rem;
    border: 1px solid #e9ecef;
}

.chart-container canvas {
    max-height: 400px;
}

/* --- Loading Skeleton Pulse Animation --- */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* --- Trading Bot Dashboard Premium Styles --- */
.tb-stats-card {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.tb-stats-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
}
.tb-stats-card::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 50%; height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.6) 50%, rgba(255,255,255,0) 100%);
    transform: skewX(-25deg);
    transition: all 0.75s ease;
}
.tb-stats-card:hover::before {
    left: 200%;
}

.tb-deal-badge {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.tb-deal-badge:hover {
    transform: scale(1.05);
    filter: brightness(0.95);
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

/* --- Responsive Media Queries for iPad & iPhone --- */
@media (max-width: 992px) {
    /* iPad / Tablet */
    .sidebar {
        width: 220px;
        min-width: 220px;
        max-width: 220px;
    }
    .kpi-card {
        min-width: 150px;
    }
    .charts-row-container {
        flex-direction: column;
    }
    .pie-chart-container, .line-chart-container {
        max-width: 100%;
        width: 100%;
    }
    
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1rem;
        border-radius: 12px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
        width: 100%;
        display: block;
    }
}

/* --- Mobile App Navigation & Overlay Defaults --- */
.mobile-header {
    display: none;
    align-items: center;
    padding: 1rem;
    background: #ffffff;
    border-bottom: 1px solid #e9ecef;
    margin: -2rem -2rem 1.5rem -2rem; /* Negate content-area padding */
}
.mobile-header h1 {
    margin: 0;
    font-size: 1.25rem;
    color: #212529;
}
.mobile-menu-toggle {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    margin-right: 1rem;
    cursor: pointer;
    color: #212529;
}
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

@media (max-width: 992px) {
    /* iPad and Mobile Layout */
    .main-layout {
        flex-direction: row; /* Keep row so sidebar can slide over */
    }
    
    .mobile-header {
        display: flex;
        margin: -1rem -1rem 1.5rem -1rem; /* Adjust for mobile padding */
    }
    
    .desktop-only {
        display: none !important;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        transform: translateX(-100%);
        z-index: 100;
        border-right: none;
        box-shadow: 2px 0 12px rgba(0,0,0,0.1);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        display: block;
    }
    
    .content-area {
        padding: 1rem;
        width: 100%;
    }
    
    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .top-header h2 {
        margin-bottom: 0.5rem;
    }
    .kpi-container {
        flex-direction: column;
    }
    .kpi-card {
        width: 100%;
    }
    
    .modal-content {
        padding: 1.5rem;
        width: 95%;
        margin: 1rem auto;
    }
    .form-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    .form-actions button {
        width: 100%;
        margin-right: 0;
    }
}
