@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

/* --- Global Reset --- */
.tsb-main-wrapper { width: 100%; max-width: 100%; padding: 10px; box-sizing: border-box; font-family: 'Roboto', sans-serif; color: #333; }
.tsb-main-wrapper * { box-sizing: border-box; }

/* --- Dashboard Header Layout --- */
.tsb-dashboard-wrapper { display: flex; gap: 20px; margin-bottom: 25px; align-items: stretch; }

/* Left Controls (Date) */
.tsb-dash-controls { 
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
    width: 120px; 
    flex-shrink: 0; 
}

#dashboard-date {
    width: 100%;
    height: 40px;
    border: 1px solid #777;
    border-radius: 4px;
    text-align: center;
    font-weight: 500;
    color: #333;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
}

/* Right Stats Row */
.tsb-stats-row { 
    display: flex; 
    flex: 1; 
    gap: 15px; 
    justify-content: space-between;
}

.stat-box { 
    flex: 1; 
    background: #fff; 
    border: 1px solid #e0e0e0; 
    border-radius: 4px; 
    padding: 10px; 
    text-align: center; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.stat-label { 
    font-size: 10px; 
    color: #999; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
    margin-bottom: 5px; 
}

/* Clean Stats - No Backgrounds */
.stat-val { 
    font-size: 20px; 
    font-weight: 700; 
    line-height: 1.2; 
    background: transparent !important; /* Force Transparent */
    padding: 0;
    display: block;
}

.green { color: #2e7d32; } 
.red { color: #c62828; } 
.blue { color: #1976d2; }

/* Mobile Dashboard Stack */
@media (max-width: 768px) {
    .tsb-dashboard-wrapper { flex-direction: column; }
    .tsb-dash-controls { width: 100%; flex-direction: row; }
    .tsb-stats-row { flex-wrap: wrap; }
    .stat-box { min-width: 45%; }
}

/* --- Form Module --- */
.tsb-module { background: #fff; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); padding: 15px; margin-bottom: 20px; }
.form-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; border-bottom: 1px solid #f0f0f0; padding-bottom: 10px; }
.form-header h3 { margin: 0; font-size: 16px; font-weight: 600; color: #333; }
.details-toggle { background: #f5f5f5; border: 1px solid #e0e0e0; font-size: 11px; padding: 4px 10px; border-radius: 4px; cursor: pointer; color: #555; font-weight: 600; }

@media (min-width: 768px) {
    .form-grid-layout { display: flex; gap: 20px; }
    .form-section-main { flex: 2; border-right: 1px solid #f0f0f0; padding-right: 20px; }
    .form-section-details { flex: 1; }
    .compact-row { display: flex; gap: 10px; margin-bottom: 10px; align-items: flex-end; }
}

@media (max-width: 767px) {
    .form-grid-layout { display: block; }
    .form-section-main { border-bottom: 1px solid #f0f0f0; padding-bottom: 15px; margin-bottom: 15px; }
    .compact-row { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
    .col { width: 100%; }
    #submit-trade { height: 44px !important; margin-top: 10px; font-size: 14px !important; }
}

.col { flex: 1; min-width: 0; }
label { display: block; font-size: 11px; font-weight: 600; color: #555; margin-bottom: 4px; }
/* Global Input Style */
input, select { width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px; height: 36px; background: #fff; }

/* FIX: Specific style for Calc Checkbox to override the 100% width above */
.calc-check {
    width: 18px !important;
    height: 18px !important;
    margin: 0 auto !important;
    display: block;
    cursor: pointer;
}

input:focus, select:focus { border-color: #2196f3; outline: none; }
#submit-trade { width: 100%; height: 36px; background: #2196f3; color: #fff; border: none; border-radius: 4px; font-weight: 700; font-size: 13px; text-transform: uppercase; cursor: pointer; transition: background 0.2s; }
#submit-trade:hover { background: #1976d2; }
.toggle-group { display: flex; gap: 5px; height: 36px; width: 100%; }
.type-btn { flex: 1; height: 100%; border: 1px solid #ddd; background: #f9f9f9; color: #666; font-weight: 700; font-size: 13px; cursor: pointer; border-radius: 4px; transition: 0.2s; margin: 0; }
.type-btn.active { background: #2196f3; color: #fff; border-color: #2196f3; }
.details-content { display: none; background: #fafafa; padding: 10px; border-radius: 4px; border: 1px solid #eee; margin-top: 10px; }

/* --- Table --- */
.table-module { padding: 0; overflow: hidden; border: 1px solid #e0e0e0; }
.table-responsive { width: 100%; overflow-x: auto; }
.tsb-table { width: 100%; min-width: 900px; border-collapse: collapse; font-size: 12px; }
.tsb-table th { background: #f9f9f9; padding: 12px 15px; text-align: left; color: #444; font-weight: 600; border-bottom: 2px solid #eee; white-space: nowrap; }
.tsb-table td { padding: 12px 15px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; color: #333; }

/* Table Action Buttons Specifics */
.action-col-wrapper { display: flex; flex-direction: column; gap: 4px; width: 140px; }
.act-row-1 { margin-bottom: 2px; }
.act-row-2 { display: flex; gap: 1px; margin-bottom: 2px; }

.status-badge { padding: 2px 6px; background: #eee; border-radius: 3px; font-size: 9px; font-weight: bold; text-transform: uppercase; color: #555; display: inline-block; margin-top: 3px; }
.high-btn { border: none; background: none; font-size: 14px; cursor: pointer; margin-left: 4px; }
.delete-row { border: none; background: none; color: #ccc; font-weight: bold; cursor: pointer; font-size: 14px; }
.delete-row:hover { color: red; }

.btn-tiny { padding: 4px 0; flex: 1; text-align: center; font-size: 10px; border: none; border-radius: 2px; background: #f0f2f5; color: #333; cursor: pointer; font-weight: 500; }
.btn-tiny[disabled] { opacity: 0.4; cursor: not-allowed; }
.btn-tiny[data-type="SL"] { background: #ffebee; color: #c62828; }
.btn-tiny[data-type^="T"] { background: #e8f5e9; color: #2e7d32; }

.toggle-log { width: 100%; background: #cfd8dc; color: #455a64; margin-top: 2px; border-radius: 2px; padding: 4px 0; font-size: 10px; border:none; cursor:pointer; }
.del-tg-btn { width: 100%; background: #ffebee; color: #c62828; margin-top: 2px; border-radius: 2px; padding: 4px 0; font-size: 10px; border:none; cursor:pointer; }

.tsb-toast { position: fixed; bottom: 20px; right: 20px; background: #333; color: #fff; padding: 10px 20px; border-radius: 4px; display: none; z-index: 99999; font-size: 13px; }