/* ══════════════════════════════════════════════
   VentaPro Cloud v2.0 — Estilos Globales
   Paleta: #111827 (Grafito) · #10B981 (Verde)
══════════════════════════════════════════════ */

:root {
  --bg:       #111827;
  --surface:  #1f2937;
  --surface2: #374151;
  --green:    #10B981;
  --green-d:  #059669;
  --green-l:  #34D399;
  --red:      #EF4444;
  --yellow:   #F59E0B;
  --text:     #F9FAFB;
  --muted:    #9CA3AF;
  --border:   #374151;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: 220px;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 100; transition: transform .25s;
  overflow-y: auto;
}
.sidebar.hidden { transform: translateX(-220px); }

.logo { padding: 18px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.logo span { font-size: 1.2rem; font-weight: 900; color: var(--green); letter-spacing: -.5px; }
.logo small { display: block; color: var(--muted); font-size: .65rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-label { padding: 14px 16px 4px; font-size: .64rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

.nav-link {
  display: flex; align-items: center; gap: 9px; padding: 10px 16px;
  color: var(--muted); text-decoration: none; font-size: .82rem;
  border-left: 3px solid transparent; cursor: pointer; transition: all .15s;
}
.nav-link:hover { color: var(--text); background: var(--surface2); }
.nav-link.active { color: var(--green); border-left-color: var(--green); background: rgba(16,185,129,.08); font-weight: 600; }

/* ── Topbar ── */
.topbar {
  position: fixed; left: 220px; right: 0; top: 0; height: 52px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 20px; gap: 12px; z-index: 99;
}
.burger { display: none; cursor: pointer; font-size: 1.2rem; color: var(--muted); }
.page-title { font-weight: 700; font-size: .95rem; flex: 1; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--green); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; color: #000; flex-shrink: 0; }

/* ── Main ── */
#main { margin-left: 220px; padding-top: 52px; min-height: 100vh; }
.page { display: none; padding: 20px; }
.page.active { display: block; }

/* ── Tarjetas ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 20px; }
.card-sm { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 14px; }

/* ── Grids ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

/* ── KPI ── */
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 18px; }
.kpi .label { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.kpi .value { font-size: 1.55rem; font-weight: 800; }
.kpi .delta { font-size: .74rem; margin-top: 4px; }
.kpi .delta.up   { color: var(--green); }
.kpi .delta.down { color: var(--red);   }

/* ── Botones ── */
.btn { padding: 8px 16px; border-radius: 7px; border: none; cursor: pointer; font-size: .82rem; font-weight: 600; transition: opacity .15s, transform .1s; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover  { opacity: .87; }
.btn:active { transform: scale(.97); }
.btn-green   { background: var(--green); color: #000; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-red     { background: var(--red); color: #fff; }
.btn-wa      { background: #25D366; color: #fff; }
.btn-sm      { padding: 5px 12px; font-size: .76rem; }

/* ── Inputs ── */
input, select, textarea {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 7px;
  color: var(--text); padding: 8px 12px; font-size: .82rem; width: 100%; outline: none;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--green); }
input::placeholder { color: var(--muted); }
select option { background: var(--surface2); }
label { font-size: .74rem; color: var(--muted); display: block; margin-bottom: 4px; }
.field { margin-bottom: 14px; }

/* ── Tabla ── */
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th { color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .5px; padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid rgba(55,65,81,.4); vertical-align: middle; }
tr:hover td { background: rgba(31,41,55,.5); }
.table-wrap { overflow-x: auto; }

/* ── Switch ── */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: var(--surface2); border-radius: 22px; transition: .25s; }
.slider::before { content:''; position: absolute; width:16px; height:16px; left:3px; bottom:3px; background:#fff; border-radius:50%; transition:.25s; }
input:checked + .slider { background: var(--green); }
input:checked + .slider::before { transform: translateX(18px); }

/* ── Tabs ── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 10px 16px; font-size: .82rem; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; transition: all .15s; }
.tab.active { color: var(--green); border-bottom-color: var(--green); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Semáforo dots ── */
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; flex-shrink: 0; }
.dot.green  { background: var(--green); }
.dot.yellow { background: var(--yellow); }
.dot.red    { background: var(--red); }

/* ── Pills ── */
.pill { display: inline-block; border-radius: 99px; padding: 2px 9px; font-size: .7rem; font-weight: 600; white-space: nowrap; }
.pill-green  { background: rgba(16,185,129,.15); color: var(--green); }
.pill-red    { background: rgba(239,68,68,.12);  color: var(--red);   }
.pill-yellow { background: rgba(245,158,11,.12); color: var(--yellow);}
.pill-gray   { background: var(--surface2);       color: var(--muted); }

/* ── Badges ── */
.badge { background: var(--green); color: #000; border-radius: 99px; padding: 2px 8px; font-size: .7rem; font-weight: 700; }
.badge.red    { background: var(--red);    color: #fff; }
.badge.yellow { background: var(--yellow); color: #000; }

/* ── Alertas ── */
.alert { border-radius: 8px; padding: 10px 14px; font-size: .82rem; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.alert-yellow { background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.25); color: var(--yellow); }
.alert-green  { background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.25); color: var(--green); }
.alert-red    { background: rgba(239,68,68,.1);  border: 1px solid rgba(239,68,68,.25);  color: var(--red);   }

/* ── Progressbar ── */
.progressbar { height: 6px; border-radius: 3px; background: var(--surface2); overflow: hidden; }
.progressbar div { height: 100%; border-radius: 3px; background: var(--green); }

/* ── Tracker pedidos ── */
.tracker { display: flex; }
.tracker-step { flex: 1; text-align: center; position: relative; }
.tracker-step::before { content:''; position:absolute; top:14px; left:-50%; right:50%; height:2px; background:var(--border); }
.tracker-step:first-child::before { display:none; }
.tracker-step.done::before { background: var(--green); }
.tracker-step .tdot { width:28px; height:28px; border-radius:50%; background:var(--surface2); border:2px solid var(--border); margin:0 auto 6px; display:flex; align-items:center; justify-content:center; font-size:.8rem; position:relative; z-index:1; }
.tracker-step.done .tdot { background:var(--green); border-color:var(--green); }
.tracker-step .tstep-label { font-size:.63rem; color:var(--muted); }
.tracker-step.done .tstep-label { color:var(--green); }

/* ── Ledger ── */
.ledger-entry { display:flex; justify-content:space-between; padding:10px 0; border-bottom:1px solid rgba(55,65,81,.4); font-size:.82rem; }
.ledger-entry .plus  { color:var(--green); font-weight:700; }
.ledger-entry .minus { color:var(--red);   font-weight:700; }

/* ── Utilities ── */
.flex { display: flex; align-items: center; }
.justify-between { justify-content: space-between; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.flex-1 { flex: 1; min-width: 0; }
.gap-2 { gap: 8px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.section-title { font-size: 1rem; font-weight: 700; margin-bottom: 16px; }
.text-green { color: var(--green); }
.text-red   { color: var(--red);   }
.text-yellow{ color: var(--yellow); }
.text-muted { color: var(--muted); }
.text-sm    { font-size: .78rem; }
.font-bold  { font-weight: 700; }
.search-wrap { position: relative; }
.search-wrap::before { content:'🔍'; position:absolute; left:11px; top:50%; transform:translateY(-50%); font-size:.8rem; }
.search-wrap input { padding-left: 34px; }
code { background: var(--surface2); padding: 2px 6px; border-radius: 4px; font-size: .8rem; color: var(--green); font-family: monospace; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2,1fr); }
  .grid-3 { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .sidebar { transform: translateX(-220px); }
  .sidebar.open { transform: translateX(0); }
  #main { margin-left: 0; }
  .topbar { left: 0; }
  .burger { display: block; }
  .page { padding: 12px; }
}
