:root {
    --bg: #f4faf9;
    --card: #ffffff;
    --primary: #0d6efd;
    --secondary: #17a673;
    --dark: #16324f;
    --text: #254052;
    --muted: #6d8596;
    --border: #d9e9e6;
    --danger: #d9534f;
    --warning: #f0ad4e;
    --shadow: 0 14px 35px rgba(22,50,79,.08);
    --radius: 18px;
}
* { box-sizing: border-box; }
body {
    margin: 0; font-family: Arial, Helvetica, sans-serif; background: linear-gradient(140deg, #eef8ff, #effcf7); color: var(--text);
}
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 270px; background: linear-gradient(180deg, #0f4f8a, #15936d); color: #fff; padding: 26px 18px; position: sticky; top: 0; height: 100vh;
}
.brand { display:flex; align-items:center; gap:14px; margin-bottom:30px; }
.brand-logo { width:54px;height:54px;border-radius:16px;background:#fff;color:#15936d;font-size:30px;font-weight:700;display:flex;align-items:center;justify-content:center; }
.brand h1 { margin:0; font-size:22px; }
.brand p { margin:4px 0 0; opacity:.9; font-size:13px; }
.nav-menu { display:grid; gap:10px; }
.nav-menu a { color:#fff; text-decoration:none; padding:12px 14px; border-radius:14px; background: rgba(255,255,255,.08); }
.nav-menu a:hover { background: rgba(255,255,255,.18); }
.content { flex:1; padding:28px; }
.topbar { margin-bottom:22px; display:flex; justify-content:space-between; align-items:center; }
.card { background: var(--card); border:1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding:22px; margin-bottom:20px; }
.grid-2, .grid-3 { display:grid; gap:18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
label { display:block; font-weight:700; margin-bottom:7px; }
input, select, textarea { width:100%; padding:12px 14px; border:1px solid var(--border); border-radius:12px; background:#fff; }
input[type=file] { padding:10px; }
button, .btn {
    display:inline-block; background: linear-gradient(90deg, var(--primary), var(--secondary)); color:#fff; border:0; padding:12px 18px; border-radius:12px; text-decoration:none; cursor:pointer; font-weight:700;
}
.btn-secondary { background: #e9f3ff; color: var(--primary); }
.btn-danger { background: var(--danger); color:#fff; }
.btn-warning { background: var(--warning); color:#fff; }
.actions { display:flex; gap:8px; flex-wrap:wrap; }
.table-wrap { overflow:auto; }
table { width:100%; border-collapse: collapse; }
th, td { padding:12px; border-bottom:1px solid var(--border); text-align:left; }
th { background:#f3fbf8; color:var(--dark); }
.alert { padding:14px 16px; border-radius:12px; margin-bottom:16px; }
.alert-success { background:#e9fff4; color:#157347; }
.alert-error { background:#fff0f0; color:#b02a37; }
.kpi { padding:18px; border-radius:18px; background:linear-gradient(140deg, #fff, #f0fbf7); border:1px solid var(--border); }
.doc-grid { display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:16px; }
.doc-card { padding:14px; border:1px solid var(--border); border-radius:14px; background:#fbfffe; }
.small { color:var(--muted); font-size:13px; }
@media (max-width: 980px) {
    .app-shell { flex-direction:column; }
    .sidebar { width:100%; height:auto; position:relative; }
    .grid-2, .grid-3, .doc-grid { grid-template-columns: 1fr; }
}

.card h3 { margin-top: 0; }


.stats-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:16px;margin:18px 0}
.stat-card strong{display:block;font-size:1.35rem;margin-top:8px;color:#0f766e}
.stat-label{font-size:.9rem;color:#64748b}
.pill-total{background:linear-gradient(135deg,#0ea5a4,#2563eb);color:#fff;padding:10px 14px;border-radius:999px;font-weight:700;box-shadow:0 10px 30px rgba(37,99,235,.18)}
.chart-box{position:relative;height:320px;margin-top:18px}
.charts-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:18px;margin-top:18px}
.small{font-size:.88rem;color:#64748b}


/* Mercadolibre */
.ml-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:18px}
.ml-card{display:block;background:linear-gradient(180deg,#fff,#f8fcff);border:1px solid var(--border);border-radius:18px;padding:22px;text-decoration:none;color:var(--text);box-shadow:var(--shadow);transition:.2s transform,.2s box-shadow}
.ml-card:hover{transform:translateY(-3px);box-shadow:0 18px 38px rgba(22,50,79,.12)}
.ml-card h3{margin:0 0 10px;color:var(--dark)}
.ml-card p{margin:0;color:var(--muted);line-height:1.5}
.ml-card .icon{font-size:30px;margin-bottom:12px}
.ml-table-day{min-width:260px}
.ml-profit{font-weight:700;color:#157347}
.ml-badge{display:inline-block;padding:6px 10px;border-radius:999px;background:#e9f3ff;color:#0d6efd;font-size:12px;font-weight:700}
.ml-badge.large{background:#fff1d6;color:#915d00}
.ml-week-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:16px}
.inline-form{display:flex;gap:10px;flex-wrap:wrap}
.inline-form > *{flex:1 1 180px}


/* Profit semanal Mercadolibre */
.profit-summary-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:16px;margin:18px 0}
.profit-summary-card{background:linear-gradient(180deg,#fff,#f8fcff);border:1px solid var(--border);border-radius:18px;padding:20px;box-shadow:var(--shadow)}
.profit-summary-card .label{display:block;font-size:.92rem;color:var(--muted);margin-bottom:8px}
.profit-summary-card .value{display:block;font-size:1.6rem;font-weight:700;color:var(--dark)}
.profit-summary-card.profit .value{color:#157347}
.profit-chart-card{padding:24px}
.profit-chart-header{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;flex-wrap:wrap;margin-bottom:18px}
.profit-chart-legend{display:flex;gap:14px;flex-wrap:wrap}
.profit-legend-item{display:flex;align-items:center;gap:8px;color:var(--muted);font-size:.92rem}
.profit-legend-color{width:12px;height:12px;border-radius:999px;display:inline-block}
.profit-legend-ingresos{background:#2563eb}
.profit-legend-gastos{background:#f59e0b}
.profit-legend-profit{background:#16a34a}
.profit-chart-wrap{overflow-x:auto;padding-bottom:8px}
.profit-chart{display:grid;grid-template-columns:repeat(7,minmax(120px,1fr));gap:16px;align-items:end;min-width:860px;min-height:340px;padding:12px 8px 0;border-top:1px solid var(--border)}
.profit-day{display:flex;flex-direction:column;align-items:center;gap:10px}
.profit-bars{height:240px;width:100%;display:flex;align-items:flex-end;justify-content:center;gap:10px;padding:0 10px}
.profit-bar{width:26px;border-radius:12px 12px 6px 6px;min-height:10px;position:relative;box-shadow:0 10px 20px rgba(15,23,42,.10)}
.profit-bar.ingresos{background:linear-gradient(180deg,#60a5fa,#2563eb)}
.profit-bar.gastos{background:linear-gradient(180deg,#fcd34d,#f59e0b)}
.profit-bar.profit{background:linear-gradient(180deg,#4ade80,#16a34a)}
.profit-bar span{position:absolute;top:-26px;left:50%;transform:translateX(-50%);font-size:.72rem;color:var(--muted);white-space:nowrap}
.profit-day-label{text-align:center}
.profit-day-label strong{display:block;color:var(--dark)}
.profit-day-label span{font-size:.84rem;color:var(--muted)}
.profit-empty{padding:32px;text-align:center;color:var(--muted)}
.profit-net-positive{color:#157347;font-weight:700}
.profit-net-negative{color:#b02a37;font-weight:700}
.profit-mini-table td,.profit-mini-table th{white-space:nowrap}
@media (max-width:980px){.profit-chart{min-width:760px}}
.profit-chart-wrap.svg-mode{overflow-x:auto;padding:8px 0 4px}
.profit-svg{width:100%;min-width:940px;height:auto;display:block}
.profit-grid-line{stroke:#dbe7ef;stroke-width:1}
.profit-zero-line{stroke:#94a3b8;stroke-width:1.5;stroke-dasharray:4 4}
.profit-svg-value{font-size:11px;fill:#64748b;text-anchor:middle;font-weight:700}
.profit-svg-value.negative{fill:#b91c1c}
.profit-svg-day{font-size:13px;fill:#16324f;text-anchor:middle;font-weight:700}
.profit-svg-date{font-size:11px;fill:#64748b;text-anchor:middle}
@media (max-width:980px){.profit-svg{min-width:860px}}
