* { margin:0; padding:0; box-sizing:border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f0f2f5; color: #333; }

.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar { width: 220px; background: #2c3e50; color: #ecf0f1; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; }
.sidebar-logo { padding: 20px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #34495e; }
.logo-icon { background: #3498db; color: #fff; font-weight: 700; font-size: 14px; padding: 6px 8px; border-radius: 4px; }
.logo-text { font-size: 18px; font-weight: 600; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: #bdc3c7; text-decoration: none; font-size: 14px; transition: all .15s; cursor: pointer; }
.nav-item:hover { background: #34495e; color: #fff; }
.nav-item.active { background: #3498db; color: #fff; font-weight: 600; }
.nav-icon { font-size: 12px; width: 16px; text-align: center; }
.sidebar-footer { padding: 16px; border-top: 1px solid #34495e; }
.sync-status { font-size: 12px; color: #95a5a6; margin-bottom: 8px; }
.btn-sync { width: 100%; padding: 8px; background: #27ae60; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 13px; font-weight: 600; }
.btn-sync:hover { background: #2ecc71; }

/* Main */
.main-content { flex: 1; margin-left: 220px; padding: 0; }
.top-bar { background: #fff; padding: 16px 24px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #e0e0e0; position: sticky; top: 0; z-index: 50; }
.top-bar h1 { font-size: 20px; font-weight: 600; }
.last-sync { font-size: 12px; color: #999; }

/* Account Tabs (multi-cuenta switcher) */
.account-tabs { display: flex; gap: 0; padding: 0 24px; background: #fff; border-bottom: 1px solid #e0e0e0; position: sticky; top: 57px; z-index: 49; }
.account-tab { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border: none; background: transparent; cursor: pointer; font-size: 14px; font-weight: 600; color: #95a5a6; border-bottom: 3px solid transparent; transition: all .15s; margin-bottom: -1px; }
.account-tab:hover { color: #2c3e50; background: #f8f9fa; }
.account-tab.active { color: #2c3e50; border-bottom-color: #3498db; background: #fff; }
.account-icon { font-size: 18px; line-height: 1; }
.account-status { width: 8px; height: 8px; border-radius: 50%; background: #bdc3c7; }
.account-status.live { background: #27ae60; box-shadow: 0 0 0 3px rgba(39,174,96,.18); }
.account-status.pending { background: #f39c12; }
.account-status.offline { background: #e74c3c; }
.account-tab .badge { font-size: 10px; background: #ecf0f1; color: #7f8c8d; padding: 3px 8px; border-radius: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.account-tab.active .badge { background: #d4e6f1; color: #21618c; }
.account-tab .account-add { color: #3498db; }

/* Pages */
.page { display: none; padding: 20px 24px; }
.page.active { display: block; }

/* Widget Tabs */
.widget-tabs { display: flex; margin-bottom: 16px; background: #fff; border-radius: 6px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.tab { flex: 1; padding: 14px; border: none; background: #fff; font-size: 14px; font-weight: 600; cursor: pointer; color: #666; transition: all .2s; }
.tab.active { background: #3498db; color: #fff; }
.tab:hover:not(.active) { background: #ecf0f1; }

/* Widgets Grid */
.widgets-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.widgets-grid.two-col { grid-template-columns: repeat(2, 1fr); }
.widgets-grid.three-col { grid-template-columns: repeat(3, 1fr); }

.widget { background: #fff; border-radius: 6px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.widget-header { padding: 10px 16px; color: #fff; display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }
.widget-header small { font-weight: 400; font-size: 12px; opacity: .9; }
.widget-header.green { background: #27ae60; }
.widget-header.blue { background: #3498db; }
.widget-header.red { background: #e74c3c; }
.widget-header.dark-green { background: #1e8449; }
.widget-header.teal { background: #0097a7; }
.widget-header.purple { background: #8e44ad; }
.widget-header.orange { background: #e67e22; }
.widget-header.dark-blue { background: #2c3e50; }

.widget-body { padding: 16px; }
.widget-body.scrollable { max-height: 220px; overflow-y: auto; }
.widget-body.chart-container { padding: 12px; height: 250px; position: relative; overflow: hidden; }
.chart-container canvas { display: block; max-width: 100%; max-height: 100%; }

/* Metrics */
.metrics-row { display: flex; justify-content: space-around; text-align: center; padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.metrics-row:last-of-type { border-bottom: none; }
.metric { flex: 1; }
.metric-val { display: block; font-size: 20px; font-weight: 700; color: #2c3e50; }
.metric-val.profit { color: #27ae60; }
.metric small { font-size: 10px; color: #999; text-transform: uppercase; letter-spacing: .5px; }

/* Top Sellers */
.top-sellers-section { border-top: 1px solid #eee; margin-top: 8px; padding-top: 8px; }
.top-sellers-title { font-size: 11px; color: #999; text-align: center; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.top-sellers-list { }
.top-seller-item { display: flex; align-items: center; gap: 8px; padding: 4px 8px; font-size: 13px; }
.top-seller-item .ts-qty { font-weight: 700; color: #2c3e50; }
.top-seller-item .ts-img { width: 28px; height: 28px; border-radius: 4px; object-fit: cover; background: #f0f0f0; }
.top-seller-item .ts-revenue { margin-left: auto; font-weight: 600; color: #27ae60; }
.ts-flag { font-size: 18px; }

/* Reimbursements */
.reimb-stat { text-align: center; padding: 12px 0; border-bottom: 1px solid #f0f0f0; }
.reimb-stat:last-child { border-bottom: none; }
.reimb-stat label { display: block; font-size: 12px; color: #999; margin-bottom: 4px; }
.reimb-val { font-size: 22px; font-weight: 700; color: #2c3e50; }
.green-text { color: #27ae60 !important; }

/* COGS Missing List */
.cogs-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #f8f8f8; font-size: 13px; }
.cogs-item .cogs-platform { font-size: 16px; }
.cogs-item .cogs-id { color: #666; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cogs-item .cogs-warn { color: #e67e22; font-size: 16px; }

/* Chart Legend */
.chart-legend { display: flex; justify-content: center; gap: 16px; margin-top: 8px; font-size: 12px; }
.chart-legend span { display: flex; align-items: center; gap: 4px; }
.chart-legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Data Tables */
.data-table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; border-radius: 6px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
table.data-table th { background: #2c3e50; color: #fff; padding: 10px 12px; text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
table.data-table td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; }
table.data-table tr:hover { background: #f8f9fa; }

/* Settings */
.settings-card { background: #fff; border-radius: 6px; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,.08); max-width: 600px; }
.settings-card h3 { margin-bottom: 16px; color: #2c3e50; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #555; margin-bottom: 4px; }
.input { width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; }
.input:focus { outline: none; border-color: #3498db; box-shadow: 0 0 0 2px rgba(52,152,219,.15); }

.btn { padding: 8px 16px; background: #3498db; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 13px; font-weight: 600; }
.btn:hover { background: #2980b9; }
.btn-primary { background: #27ae60; }
.btn-primary:hover { background: #229954; }

.cred-status { margin-top: 12px; padding: 8px 12px; border-radius: 4px; font-size: 13px; display: none; }
.cred-status.ok { display: block; background: #d5f5e3; color: #1e8449; }
.cred-status.err { display: block; background: #fadbd8; color: #c0392b; }

/* Page Toolbar */
.page-toolbar { display: flex; gap: 12px; margin-bottom: 16px; align-items: center; }
.page-toolbar .input { width: auto; }

/* P&L */
.pyl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pyl-card { background: #fff; border-radius: 6px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.pyl-card h4 { font-size: 13px; color: #999; text-transform: uppercase; margin-bottom: 8px; }
.pyl-card .pyl-val { font-size: 28px; font-weight: 700; }

/* Charts page */
.charts-page-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }

/* Empty state */
.empty { text-align: center; color: #999; padding: 20px; font-size: 14px; }
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state h2 { color: #2c3e50; margin-bottom: 8px; }
.empty-state p { color: #999; }

/* Scrollbar */
.scrollable::-webkit-scrollbar { width: 6px; }
.scrollable::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.red-text { color: #e74c3c !important; }
.pyl-sub { font-size: 12px; color: #999; margin-top: 4px; }
.pyl-section { margin-bottom: 24px; }
.pyl-section h3 { margin-bottom: 12px; color: #2c3e50; font-size: 18px; }
.page-loading { opacity: 0.4; pointer-events: none; transition: opacity .15s; }
.page-loaded { opacity: 1; pointer-events: auto; transition: opacity .15s; }
.page { animation: fadeIn .15s ease-in; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
