/* === RESET & BASE === */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f6fa;
    color: #2d3436;
    font-size: 14px;
    line-height: 1.5;
}

a { color: #667eea; text-decoration: none; }
a:hover { text-decoration: underline; }

/* === LOGIN === */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #1a1a2e;
}

.login-container {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin-bottom: 12px;
    border-radius: 12px;
}

.login-header h1 {
    font-size: 28px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-header p {
    color: #999;
    margin-top: 4px;
    font-size: 13px;
}

.login-form .form-group {
    margin-bottom: 18px;
}

.login-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #444;
    font-size: 13px;
}

.login-form input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: #667eea;
}

/* === NAVBAR === */
.navbar {
    display: flex;
    align-items: center;
    background: #1a1a2e;
    padding: 0 24px;
    height: 60px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.nav-logo {
    height: 42px;
    width: auto;
    border-radius: 6px;
    margin-right: 24px;
    transition: transform 0.2s;
}

.nav-logo:hover {
    transform: scale(1.05);
}

.nav-links {
    display: flex;
    gap: 4px;
    flex: 1;
}

.nav-link {
    color: rgba(255,255,255,0.7);
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
    letter-spacing: 0.3px;
}

.nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    text-decoration: none;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-badge {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.badge-wazz {
    background: #27ae60;
    color: white;
}

.badge-zzatar {
    background: #e67e22;
    color: white;
}

.btn-logout {
    color: rgba(255,255,255,0.6);
    font-size: 12px;
    padding: 6px 14px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    text-decoration: none;
}

/* === CONTAINER === */
.container {
    max-width: 1600px;
    margin: 24px auto;
    padding: 0 24px;
}

/* === PAGE HEADER === */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 22px;
    color: #2d3436;
    font-weight: 700;
}

/* === BUTTONS === */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-secondary {
    background: #e8e8e8;
    color: #333;
}

.btn-full { width: 100%; }

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 5px;
}

.btn-edit { background: #3498db; color: white; }
.btn-sell { background: #27ae60; color: white; }
.btn-delete { background: #e74c3c; color: white; }
.btn-link-ext { background: #6c5ce7; color: white; }

/* === ALERTS === */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
}

.alert-danger {
    background: #fce4ec;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

/* === STATS GRID (Dashboard) === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid #eee;
}

.stat-icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.stat-number {
    font-size: 24px;
    font-weight: 800;
    color: #2d3436;
}

.stat-label {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-profit .stat-number {
    color: #27ae60;
}

/* === SOLDE CARD === */
.solde-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid #eee;
    margin-bottom: 24px;
}

.solde-card h2 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #2d3436;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.solde-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.solde-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #f8f9fa;
    border-radius: 8px;
}

.solde-label {
    font-size: 14px;
    color: #555;
}

.solde-value {
    font-weight: 700;
    font-size: 16px;
}

.solde-final {
    background: linear-gradient(135deg, #f5f7ff, #f0f0ff);
    border: 2px solid #667eea;
    margin-top: 8px;
}

.solde-big {
    font-size: 22px !important;
}

/* === RESUME GRID === */
.resume-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.resume-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid #eee;
}

.resume-card h2 {
    font-size: 16px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card-wazz { border-top: 3px solid #27ae60; }
.card-wazz h2 { color: #27ae60; }

.card-zzatar { border-top: 3px solid #e67e22; }
.card-zzatar h2 { color: #e67e22; }

.resume-row {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px solid #f8f8f8;
}

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

.resume-row .label { color: #777; font-size: 13px; }
.resume-row .value { font-weight: 700; font-size: 13px; }

.resume-total {
    background: #f8f9fa;
    padding: 10px 12px;
    border-radius: 8px;
    margin-top: 8px;
    border: 1px solid #e8e8e8;
}

.resume-total .label { font-weight: 700; color: #333; }

.positive { color: #27ae60; }
.negative { color: #e74c3c; }
.warning-text { color: #f39c12; }

/* === INFO CARD === */
.info-card {
    background: white;
    border-radius: 12px;
    padding: 20px 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid #eee;
    margin-bottom: 24px;
}

.info-card h3 {
    font-size: 15px;
    color: #555;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

/* === CHARTS === */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.chart-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid #eee;
}

/* === DETAIL SECTION === */
.detail-section {
    margin-bottom: 24px;
}

.detail-section h2 {
    font-size: 16px;
    color: #2d3436;
    margin-bottom: 12px;
}

/* === TABLES === */
.table-wrapper {
    overflow-x: auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid #eee;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.data-table th {
    background: #f8f9fa;
    padding: 10px 12px;
    font-size: 10px;
    text-transform: uppercase;
    color: #888;
    font-weight: 700;
    text-align: left;
    border-bottom: 2px solid #eee;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
}

.data-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f4f4f4;
    font-size: 13px;
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.1s;
}

.data-table tbody tr:hover {
    background: #f8f9ff;
}

.data-table-compact td {
    padding: 6px 10px;
    font-size: 12px;
}

.data-table-compact th {
    padding: 8px 10px;
    font-size: 9px;
}

.clickable-row {
    cursor: pointer;
}

.cell-id {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
    color: #999;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.cell-item {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.cell-comment {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: #999;
}

.cell-reversement {
    font-size: 11px;
    white-space: nowrap;
    color: #666;
}

.center { text-align: center; }
.number { text-align: right; font-variant-numeric: tabular-nums; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; }
.empty { text-align: center; color: #bbb; padding: 40px !important; font-style: italic; }

.actions {
    white-space: nowrap;
    display: flex;
    gap: 4px;
}

.links {
    display: flex;
    gap: 4px;
}

.row-danger { background: #fff5f5; }
.row-warning { background: #fffde7; }

/* === BADGES === */
.canal-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.canal-AMAZON { background: #fff3e0; color: #e65100; }
.canal-EBAY { background: #e3f2fd; color: #1565c0; }
.canal-AUTRE { background: #f3e5f5; color: #7b1fa2; }

.vendeur-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.badge-oui {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.badge-non {
    background: #fce4ec;
    color: #c62828;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

/* === EDITABLE CELLS === */
.editable-cell {
    cursor: pointer;
    position: relative;
}

.editable-cell:hover {
    background: #e8f0fe !important;
}

.editable-cell::after {
    content: ' \270E';
    color: #bbb;
    font-size: 10px;
}

.editable-header::after {
    content: ' (clic)';
    font-style: italic;
    font-weight: normal;
    color: #bbb;
    font-size: 8px;
}

.editable-input {
    width: 80px;
    padding: 4px 6px;
    border: 2px solid #667eea;
    border-radius: 4px;
    font-size: 12px;
    text-align: right;
    font-family: inherit;
}

/* === TOGGLE BOOL === */
.toggle-bool {
    cursor: pointer;
    user-select: none;
}

.toggle-bool:hover .badge-oui,
.toggle-bool:hover .badge-non {
    opacity: 0.8;
    box-shadow: 0 0 0 2px #667eea;
}

/* === FORMS === */
.form-card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid #eee;
    max-width: 800px;
}

.form-group {
    margin-bottom: 16px;
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-row {
    display: flex;
    gap: 16px;
}

.checkboxes {
    margin: 16px 0;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.radio-group {
    margin: 16px 0;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.radio-group-title {
    font-weight: 700;
    font-size: 11px;
    display: block;
    margin-bottom: 8px;
    text-transform: uppercase;
    color: #666;
}

.radio-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 20px;
    font-size: 13px;
    cursor: pointer;
}

.radio-label input[type="radio"] {
    width: auto;
}

.optional {
    font-size: 11px;
    color: #bbb;
    font-weight: normal;
}

.hidden { display: none; }

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.form-card h3 {
    font-size: 15px;
    color: #555;
    margin: 20px 0 10px 0;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

/* === SIDEBAR === */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.3);
    z-index: 200;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    display: block;
}

.sidebar {
    position: fixed;
    top: 0;
    right: -480px;
    width: 460px;
    height: 100%;
    background: white;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    z-index: 300;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.sidebar.active {
    right: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #1a1a2e;
    color: white;
    position: sticky;
    top: 0;
}

.sidebar-header h3 {
    font-size: 15px;
    font-weight: 700;
}

.sidebar-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.sidebar-close:hover {
    background: rgba(255,255,255,0.15);
}

.sidebar-content {
    padding: 20px;
}

.sidebar-section {
    margin-bottom: 20px;
}

.sidebar-section h4 {
    font-size: 12px;
    text-transform: uppercase;
    color: #999;
    letter-spacing: 1px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #eee;
}

.sidebar-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 13px;
}

.sidebar-row .s-label {
    color: #888;
}

.sidebar-row .s-value {
    font-weight: 600;
    color: #333;
    text-align: right;
}

.sidebar-row .s-value.positive { color: #27ae60; }
.sidebar-row .s-value.negative { color: #e74c3c; }

.sidebar-sub-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-top: 8px;
}

.sidebar-sub-table th {
    background: #f5f6fa;
    padding: 6px 8px;
    text-align: left;
    font-size: 10px;
    text-transform: uppercase;
    color: #888;
}

.sidebar-sub-table td {
    padding: 5px 8px;
    border-bottom: 1px solid #f0f0f0;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .stats-grid { grid-template-columns: 1fr; }
    .resume-grid { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; }
    .navbar { flex-wrap: wrap; height: auto; padding: 12px; gap: 8px; }
    .nav-links { order: 3; width: 100%; }
    .sidebar { width: 100%; right: -100%; }
}
