/* ============================================================
   MiTienda Pro — Hoja de Estilos Principal
   ============================================================ */
:root {
  --bg: #0d0f14;
  --surface: #161920;
  --surface2: #1e2230;
  --surface3: #252a3a;
  --border: #2a2f42;
  --accent: #f5c542;
  --accent2: #4ade80;
  --accent3: #f87171;
  --accent4: #60a5fa;
  --text: #e8eaf0;
  --text2: #8892a4;
  --text3: #5a6278;
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 220px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 14px;
  min-height: 100vh;
  line-height: 1.5;
}
h1,h2,h3,h4,h5 { font-family: 'Syne', sans-serif; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── LOGIN ─────────────────────────────────────────────────── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-wrap { width: 100%; display: flex; align-items: center; justify-content: center; }
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 40px;
  width: 380px;
  text-align: center;
}
.login-logo { font-family:'Syne',sans-serif; font-size:28px; font-weight:800; color:var(--accent); margin-bottom:6px; }
.login-sub { color:var(--text2); font-size:13px; margin-bottom:28px; }
.login-hint { color:var(--text3); font-size:12px; margin-top:16px; }
.login-card .form-group { text-align:left; margin-bottom:14px; }

/* ── LAYOUT ─────────────────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; left:0; top:0; bottom:0; width:var(--sidebar-w);
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 100;
}
.sidebar-logo {
  padding: 22px 20px 18px;
  font-family: 'Syne', sans-serif; font-size:18px; font-weight:800; color:var(--accent);
  border-bottom: 1px solid var(--border);
}
.sidebar-logo span { display:block; color:var(--text3); font-weight:400; font-size:11px; margin-top:2px; }
nav { flex:1; padding:14px 10px; display:flex; flex-direction:column; gap:3px; }
.nav-item {
  display:flex; align-items:center; gap:10px;
  padding:10px 12px; border-radius:var(--radius-sm);
  color:var(--text2); font-size:13px; font-weight:500;
  transition:.15s; border:none; background:none; width:100%;
}
.nav-item:hover { background:var(--surface2); color:var(--text); }
.nav-item.active { background:rgba(245,197,66,.12); color:var(--accent); }
.nav-item .icon { font-size:16px; width:20px; text-align:center; }
.sidebar-bottom { padding:12px 10px; border-top:1px solid var(--border); }
.user-info { display:flex; align-items:center; gap:8px; padding:8px 12px; color:var(--text2); font-size:12px; margin-bottom:4px; }
.btn-logout {
  display:flex; align-items:center; gap:8px;
  padding:9px 12px; border-radius:var(--radius-sm);
  color:var(--text3); font-size:13px; cursor:pointer;
  background:none; border:none; width:100%; transition:.15s;
}
.btn-logout:hover { color:var(--accent3); background:rgba(248,113,113,.08); }
.main-content { margin-left:var(--sidebar-w); padding:28px; flex:1; }

/* ── PAGE HEADER ─────────────────────────────────────────────── */
.page-header { margin-bottom:24px; }
.page-title { font-size:24px; font-weight:800; line-height:1; }
.page-title span { color:var(--accent); }
.page-sub { color:var(--text2); font-size:13px; margin-top:5px; }

/* ── CARDS ─────────────────────────────────────────────────── */
.card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:20px; }
.card-title { font-family:'Syne',sans-serif; font-size:14px; font-weight:700; color:var(--text2); margin-bottom:14px; }

/* ── STAT CARDS ─────────────────────────────────────────────── */
.stat-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:22px; }
.stat-card {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:20px; position:relative; overflow:hidden;
}
.stat-card::before { content:''; position:absolute; top:0; left:0; right:0; height:3px; }
.stat-card.c1::before { background:var(--accent); }
.stat-card.c2::before { background:var(--accent2); }
.stat-card.c3::before { background:var(--accent4); }
.stat-card.c4::before { background:var(--accent3); }
.stat-label { color:var(--text2); font-size:11px; text-transform:uppercase; letter-spacing:.5px; margin-bottom:8px; }
.stat-value { font-family:'Syne',sans-serif; font-size:26px; font-weight:800; }
.stat-sub { color:var(--text3); font-size:12px; margin-top:4px; }
.stat-icon { font-size:28px; position:absolute; right:14px; top:14px; opacity:.18; }
.mini-stat { background:var(--surface2); border:1px solid var(--border); border-radius:var(--radius-sm); padding:12px 16px; }

/* ── CHARTS ─────────────────────────────────────────────────── */
.chart-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-bottom:22px; }
.chart-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:20px; }
.chart-title { font-family:'Syne',sans-serif; font-size:13px; font-weight:700; color:var(--text2); margin-bottom:14px; }

/* ── TWO COL ─────────────────────────────────────────────────── */
.two-col-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }

/* ── TOOLBAR ─────────────────────────────────────────────────── */
.toolbar { display:flex; justify-content:space-between; align-items:center; margin-bottom:14px; flex-wrap:wrap; gap:10px; }
.filter-bar { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }

/* ── FORMS ─────────────────────────────────────────────────── */
.form-group { display:flex; flex-direction:column; gap:5px; }
.form-group label { font-size:12px; color:var(--text2); font-weight:500; text-transform:uppercase; letter-spacing:.4px; }
input[type=text], input[type=number], input[type=password], input[type=date], input[type=email],
select, textarea {
  background:var(--surface2); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:9px 13px;
  color:var(--text); font-size:13px; outline:none; transition:.2s; width:100%;
}
input:focus, select:focus, textarea:focus { border-color:var(--accent); }
select option { background:var(--surface2); }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.info-display {
  background:var(--surface3); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:9px 13px;
  font-family:'Syne',sans-serif; font-size:18px; font-weight:800; color:var(--accent2);
}

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  padding:9px 18px; border-radius:var(--radius-sm);
  font-size:13px; font-weight:600; border:none; transition:.15s; cursor:pointer;
  font-family: 'DM Sans', inherit; white-space:nowrap;
}
.btn-primary { background:var(--accent); color:#0d0f14; }
.btn-primary:hover { background:#e6b530; }
.btn-secondary { background:var(--surface2); color:var(--text); border:1px solid var(--border); }
.btn-secondary:hover { background:var(--surface3); }
.btn-danger { background:rgba(248,113,113,.12); color:var(--accent3); border:1px solid rgba(248,113,113,.2); }
.btn-danger:hover { background:rgba(248,113,113,.2); }
.btn-success { background:rgba(74,222,128,.12); color:var(--accent2); border:1px solid rgba(74,222,128,.2); }
.btn-success:hover { background:rgba(74,222,128,.22); }
.btn-sm { padding:5px 11px; font-size:12px; }
.btn-block { width:100%; margin-top:8px; padding:12px; font-size:14px; }

/* ── TABLES ─────────────────────────────────────────────────── */
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; }
th {
  text-align:left; padding:9px 13px;
  font-size:11px; text-transform:uppercase; letter-spacing:.5px;
  color:var(--text3); border-bottom:1px solid var(--border); font-weight:600;
}
td { padding:11px 13px; border-bottom:1px solid rgba(42,47,66,.4); vertical-align:middle; }
tr:last-child td { border-bottom:none; }
tr:hover td { background:rgba(255,255,255,.018); }
.empty { text-align:center; color:var(--text3); padding:20px 13px; }
.empty.green { color:var(--accent2); }

/* ── BADGES ─────────────────────────────────────────────────── */
.badge { display:inline-block; padding:3px 9px; border-radius:20px; font-size:11px; font-weight:600; }
.badge-green  { background:rgba(74,222,128,.12); color:var(--accent2); }
.badge-red    { background:rgba(248,113,113,.12); color:var(--accent3); }
.badge-yellow { background:rgba(245,197,66,.12);  color:var(--accent); }
.badge-blue   { background:rgba(96,165,250,.12);  color:var(--accent4); }

/* ── PROFIT ─────────────────────────────────────────────────── */
.profit-up   { color:var(--accent2); }
.profit-down { color:var(--accent3); }

/* ── ALERTS ─────────────────────────────────────────────────── */
.alert { padding:10px 14px; border-radius:var(--radius-sm); margin-bottom:14px; font-size:13px; }
.alert-danger  { background:rgba(248,113,113,.12); border:1px solid rgba(248,113,113,.3); color:var(--accent3); }
.alert-success { background:rgba(74,222,128,.12);  border:1px solid rgba(74,222,128,.3);  color:var(--accent2); }

/* ── MODALS ─────────────────────────────────────────────────── */
.modal-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,.75);
  z-index:200; display:none; align-items:center; justify-content:center;
}
.modal-overlay.open { display:flex; }
.modal {
  background:var(--surface); border:1px solid var(--border);
  border-radius:16px; padding:28px; width:560px;
  max-width:95vw; max-height:92vh; overflow-y:auto;
}
.modal-title { font-family:'Syne',sans-serif; font-size:18px; font-weight:800; margin-bottom:20px; color:var(--accent); }
.modal-actions { display:flex; gap:10px; justify-content:flex-end; margin-top:22px; }

/* ── SALE ITEMS ─────────────────────────────────────────────── */
.item-row {
  display:flex; align-items:center; gap:8px;
  background:var(--surface2); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:8px 10px;
}
.item-row select, .item-row input { flex:1; background:var(--surface3); }
.item-row .qty-input { width:70px; flex:none; }
.item-row .remove-btn { background:none; border:none; color:var(--accent3); font-size:18px; cursor:pointer; padding:0 4px; line-height:1; }

/* ── TOTALS BOX ─────────────────────────────────────────────── */
.totals-box { background:var(--surface2); border:1px solid var(--border); border-radius:var(--radius-sm); padding:14px; }
.total-row { display:flex; justify-content:space-between; align-items:center; padding:4px 0; }
.total-final { border-top:1px solid var(--border); padding-top:10px; margin-top:6px; font-weight:700; font-size:16px; }
.total-final span:last-child { font-family:'Syne',sans-serif; font-size:20px; color:var(--accent); }

/* ── REPORTS ─────────────────────────────────────────────────── */
.report-section { margin-bottom:28px; }
.report-section-title {
  font-family:'Syne',sans-serif; font-size:16px; font-weight:800;
  margin-bottom:14px; padding-bottom:10px; border-bottom:1px solid var(--border);
}

/* ── SCROLLBAR ─────────────────────────────────────────────── */
::-webkit-scrollbar { width:6px; height:6px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--surface3); border-radius:3px; }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width:960px) {
  :root { --sidebar-w: 60px; }
  .sidebar-logo span, .nav-item .label, .user-info .label,
  .btn-logout .label, .sidebar-logo { display:none; }
  .sidebar-logo { padding:16px; font-size:22px; }
  .main-content { padding:16px; }
  .stat-grid { grid-template-columns:1fr 1fr; }
  .chart-grid, .two-col-grid { grid-template-columns:1fr; }
  .form-grid { grid-template-columns:1fr; }
}
@media (max-width:600px) {
  .stat-grid { grid-template-columns:1fr; }
}
