:root {
  --sidebar-width: 220px;
  --navbar-height: 56px;
  --bottom-nav-height: 64px;
  --accent: #ffc107;
}

body {
  background: #f0f2f5;
  padding-top: var(--navbar-height);
  font-size: 15px;
}

/* Sidebar desktop */
#sidebar {
  width: var(--sidebar-width);
  min-height: calc(100vh - var(--navbar-height));
  position: sticky;
  top: var(--navbar-height);
  height: calc(100vh - var(--navbar-height));
  overflow-y: auto;
  flex-shrink: 0;
  display: none;
}

@media (min-width: 768px) {
  #sidebar { display: flex; flex-direction: column; }
  body { padding-bottom: 0; }
  .main-content { min-height: calc(100vh - var(--navbar-height)); }
}

/* Mobile bottom nav */
@media (max-width: 767px) {
  body { padding-bottom: var(--bottom-nav-height); }
}

.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-height);
  background: #1a1a2e;
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 1000;
  border-top: 1px solid rgba(255,255,255,.08);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: rgba(255,255,255,.45);
  text-decoration: none;
  font-size: 10px;
  flex: 1;
  padding: 8px 0;
  transition: color .2s;
}

.bottom-nav a i { font-size: 22px; }
.bottom-nav a.active, .bottom-nav a:hover { color: var(--accent); }

/* Sidebar links */
#sidebar .nav-link { border-radius: 8px; padding: 9px 12px; transition: all .2s; font-size: 14px; }
#sidebar .nav-link:hover, #sidebar .nav-link.active { background: rgba(255,255,255,.08); color: #fff !important; }
#sidebar .nav-link.active { border-left: 3px solid var(--accent); }

/* Cards KPI */
.kpi-card {
  background: #fff;
  border-radius: 16px;
  padding: 1.25rem;
  border: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.kpi-card .kpi-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}

.kpi-card .kpi-value { font-size: 24px; font-weight: 700; margin: 8px 0 2px; }
.kpi-card .kpi-label { font-size: 13px; color: #6c757d; }
.kpi-card .kpi-sub { font-size: 12px; margin-top: 4px; }

/* Cards generales */
.card { border: none; border-radius: 16px; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.card-header { background: transparent; border-bottom: 1px solid rgba(0,0,0,.06); font-weight: 600; }

/* Badges de estado */
.badge-disponible { background: #d1fae5; color: #065f46; }
.badge-vendido { background: #dbeafe; color: #1e40af; }
.badge-cambiado { background: #fef3c7; color: #92400e; }
.badge-apartado { background: #f3e8ff; color: #6b21a8; }

/* Botón flotante agregar */
.btn-fab {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 16px);
  right: 20px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  border: none;
  font-size: 26px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(255,193,7,.5);
  z-index: 999;
  text-decoration: none;
}

@media (min-width: 768px) {
  .btn-fab { bottom: 24px; }
}

/* Tabla responsive */
.table-card { background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #6c757d; font-weight: 600; border-bottom: 1px solid #f0f2f5; }
.table td { vertical-align: middle; }
.table tbody tr:hover { background: #f8f9fa; }

/* Forms */
.form-control, .form-select { border-radius: 10px; border: 1.5px solid #e2e8f0; padding: .6rem 1rem; }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,193,7,.15); }
.btn { border-radius: 10px; padding: .55rem 1.25rem; font-weight: 500; }
.btn-warning { color: #000; }

/* Page title */
.page-title { font-size: 22px; font-weight: 700; margin-bottom: 1.25rem; }

/* Ganancia highlight */
.ganancia-positiva { color: #059669; font-weight: 600; }
.ganancia-negativa { color: #dc2626; font-weight: 600; }

/* iOS safe area */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-nav { padding-bottom: env(safe-area-inset-bottom); height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom)); }
}
