/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Tahoma', sans-serif;
}

body {
    background: #f4f7fc;
    color: #1e2a3a;
    padding: 24px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.app {
    max-width: 1400px;
    width: 100%;
    background: white;
    border-radius: 24px;
    box-shadow: 0 12px 40px rgba(0, 20, 40, 0.08);
    padding: 28px 32px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 2px solid #e6edf5;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    height: 40px;
    width: auto;
    display: block;
}

.header h1 {
    font-weight: 600;
    font-size: 26px;
    letter-spacing: 0.5px;
    color: #0b2a4a;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    background: #ffffff;
    border: 1px solid #d0dce8;
    color: #1e3a5f;
    padding: 8px 18px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.btn:hover {
    background: #f0f5ff;
    border-color: #6b9ed8;
    box-shadow: 0 4px 10px rgba(0, 80, 180, 0.08);
}

.btn-primary {
    background: #1a5f9e;
    border-color: #1a5f9e;
    color: white;
}

.btn-primary:hover {
    background: #134b7c;
    border-color: #134b7c;
    color: white;
}

.btn-danger {
    border-color: #c0392b;
    color: #c0392b;
}

.btn-danger:hover {
    background: #c0392b;
    color: white;
    border-color: #c0392b;
}

.btn-outline {
    background: transparent;
    border: 1px solid #b0c8dd;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 28px;
    border-bottom: 1px solid #e6edf5;
    padding-bottom: 2px;
    flex-wrap: wrap;
}

.tab-btn {
    background: transparent;
    border: none;
    color: #5f7d9c;
    padding: 10px 22px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    border-radius: 30px 30px 0 0;
    transition: all 0.2s;
    position: relative;
}

.tab-btn:hover {
    background: #eef4fa;
    color: #1a3a5a;
}

.tab-btn.active {
    color: #1a5f9e;
    background: #eaf1fa;
    font-weight: 600;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 20%;
    right: 20%;
    height: 3px;
    background: #1a5f9e;
    border-radius: 10px;
}

.tab-content {
    display: none;
    background: #ffffff;
    border-radius: 16px;
    padding: 6px 0;
}

.tab-content.active {
    display: block;
}

/* Form */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 18px 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 13px;
    color: #2d4a6a;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    background: #f9fbfd;
    border: 1px solid #d7e2ed;
    border-radius: 10px;
    padding: 9px 14px;
    color: #1a2a3a;
    font-size: 14px;
    transition: 0.15s;
    width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4a8bc2;
    box-shadow: 0 0 0 3px rgba(26, 95, 158, 0.12);
    background: white;
}

.form-group textarea {
    resize: vertical;
    min-height: 54px;
}

/* ===== STYLISH UPLOAD BUTTONS ===== */
.upload-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

.upload-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(145deg, #f9fbfd, #eef4fa);
    border: 2px dashed #b0c8dd;
    border-radius: 14px;
    padding: 14px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 15px;
    font-weight: 500;
    color: #1e3a5f;
    position: relative;
    overflow: hidden;
}

.upload-label:hover {
    background: linear-gradient(145deg, #f0f5ff, #e2ebf5);
    border-color: #4a8bc2;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(26, 95, 158, 0.12);
}

.upload-label:active {
    transform: scale(0.97);
}

.upload-label .upload-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #1a5f9e;
    color: white;
    border-radius: 50%;
    font-size: 22px;
    font-weight: 300;
    line-height: 1;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.upload-label:hover .upload-icon {
    background: #134b7c;
    transform: rotate(90deg) scale(1.1);
}

.upload-label .upload-text {
    letter-spacing: 0.3px;
}

.file-name {
    font-size: 12px;
    color: #7f9bb5;
    padding-right: 6px;
    min-height: 20px;
    display: block;
    transition: color 0.3s;
}

.file-name.has-file {
    color: #1a5f9e;
    font-weight: 500;
}

/* Preview image */
.file-preview {
    margin-top: 6px;
    max-width: 100%;
    max-height: 120px;
    border-radius: 8px;
    border: 1px solid #d7e2ed;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.form-group .range-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-group .range-wrap input[type="range"] {
    flex: 1;
    background: #d7e2ed;
    height: 5px;
    border-radius: 10px;
    -webkit-appearance: none;
}

.form-group .range-wrap input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1a5f9e;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.range-value {
    min-width: 30px;
    text-align: center;
    font-weight: 600;
    color: #1a5f9e;
    background: #eaf1fa;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 14px;
}

.form-group .checklist-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #f9fbfd;
    padding: 14px 18px;
    border-radius: 12px;
    border: 1px solid #d7e2ed;
}

.form-group .checklist-group label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #1e3a5f;
    cursor: pointer;
    font-weight: 400;
}

.form-group .checklist-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #1a5f9e;
    cursor: pointer;
    margin: 0;
}

.full-width {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    flex-wrap: wrap;
}

/* Table */
.table-wrap {
    overflow-x: auto;
    margin-top: 16px;
    border-radius: 12px;
    border: 1px solid #e6edf5;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th, td {
    padding: 12px 14px;
    text-align: right;
    border-bottom: 1px solid #eef4fa;
    vertical-align: middle;
}

th {
    background: #f2f7fd;
    color: #1a3a5a;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 2;
}

tr:hover td {
    background: #f7faff;
}

.badge {
    display: inline-block;
    padding: 3px 14px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-win {
    background: #dff0d8;
    color: #2d6a2d;
}
.badge-loss {
    background: #f2dede;
    color: #a94442;
}
.badge-breakeven {
    background: #fcf8e3;
    color: #8a6d3b;
}

.filter-bar {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: center;
    background: #f9fbfd;
    padding: 14px 20px;
    border-radius: 14px;
    margin-bottom: 18px;
    border: 1px solid #e6edf5;
}

.filter-bar input,
.filter-bar select {
    background: white;
    border: 1px solid #d7e2ed;
    padding: 6px 14px;
    border-radius: 30px;
    color: #1a2a3a;
    font-size: 13px;
    min-width: 120px;
}

.filter-bar input:focus,
.filter-bar select:focus {
    outline: none;
    border-color: #4a8bc2;
    box-shadow: 0 0 0 3px rgba(26, 95, 158, 0.1);
}

.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #f9fbfd;
    border: 1px solid #e6edf5;
    border-radius: 14px;
    padding: 18px 14px;
    text-align: center;
}

.stat-card .num {
    font-size: 28px;
    font-weight: 700;
    color: #1a5f9e;
    margin-top: 4px;
}

.stat-card .label {
    font-size: 13px;
    color: #4f6f8f;
    font-weight: 500;
}

.review-period {
    display: flex;
    gap: 10px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.review-period .btn {
    background: #f2f7fd;
    border: 1px solid #d7e2ed;
    border-radius: 30px;
    padding: 6px 20px;
    font-weight: 500;
}

.review-period .btn.active {
    background: #1a5f9e;
    border-color: #1a5f9e;
    color: white;
}

.signature-box {
    background: #f9fbfd;
    border: 1px solid #d7e2ed;
    padding: 14px;
    border-radius: 12px;
    text-align: center;
    color: #1e3a5f;
    font-weight: 500;
}

.signature-box label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
}

.signature-box input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #1a5f9e;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 20, 40, 0.35);
    backdrop-filter: blur(3px);
    z-index: 999;
    justify-content: center;
    align-items: center;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: white;
    border-radius: 24px;
    padding: 32px 36px;
    max-width: 520px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal h2 {
    color: #0b2a4a;
    margin-bottom: 16px;
    font-weight: 600;
}

.modal .btn-close-modal {
    background: transparent;
    border: none;
    color: #7f9bb5;
    float: left;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

.modal .btn-close-modal:hover {
    color: #1a3a5a;
}

.modal input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 1px dashed #b0c8dd;
    border-radius: 12px;
    background: #f9fbfd;
    margin: 12px 0;
}

/* misc */
.text-primary { color: #1a5f9e; }
.mt-10 { margin-top: 12px; }
.mb-10 { margin-bottom: 12px; }
.flex { display: flex; }
.flex-center { align-items: center; gap: 8px; }
.gap-8 { gap: 8px; }

@media (max-width: 768px) {
    .app { padding: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .header { flex-direction: column; align-items: stretch; }
    .header-actions { justify-content: flex-start; }
    .stat-cards { grid-template-columns: 1fr 1fr; }
    .tab-btn { padding: 8px 14px; font-size: 13px; }
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #eef4fa; border-radius: 10px; }
::-webkit-scrollbar-thumb { background: #b0c8dd; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #4a8bc2; }