@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --bg-darkest: #020617; /* slate-950 */
  --bg-dark: #0f172a;    /* slate-900 */
  --bg-card: #0f172a;
  --bg-input: #020617;
  --border-color: #1e293b; /* slate-800 */
  --border-hover: #e5383b; /* Crimson red */
  
  --text-white: #ffffff;
  --text-gray-light: #f1f5f9; /* slate-100 */
  --text-gray: #94a3b8;       /* slate-400 */
  --text-muted: #475569;      /* slate-600 */
  
  --accent-red: #e5383b;      /* Primary crimson */
  --accent-red-hover: #ba1826;
  --accent-emerald: #10b981;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-darkest);
  color: var(--text-gray-light);
  min-height: 100vh;
  overflow-x: hidden;
}

/* --- Layout --- */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.idx-sidebar {
  width: 260px;
  background: var(--bg-dark);
  border-right: 1px solid var(--border-color);
  padding: 16px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 60px;
  height: calc(100vh - 60px);
  z-index: 100;
}

.menu-list {
  list-style: none;
  flex-grow: 1;
  overflow-y: auto;
}

/* Hide scrollbar on menu */
.menu-list::-webkit-scrollbar {
  display: none;
}

.menu-item {
  margin-bottom: 4px;
}

.menu-link {
  display: flex;
  align-items: center;
  padding: 11px 14px;
  color: var(--text-gray);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.menu-link i {
  margin-right: 12px;
  font-size: 1.15rem;
  width: 20px;
  text-align: center;
}

.menu-link:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-white);
}

.menu-item.active .menu-link {
  background: rgba(229, 56, 59, 0.08);
  color: var(--accent-red);
}

.sidebar-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
  margin-top: 16px;
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
  padding: 0 12px;
}

.sidebar-user-email {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-white);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-role {
  font-size: 0.7rem;
  color: var(--text-gray);
  margin-top: 2px;
}

.btn-logout {
  width: 100%;
  padding: 8px 12px;
  background: rgba(229, 56, 59, 0.05);
  border: 1px solid rgba(229, 56, 59, 0.2);
  color: #f87171;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  background: rgba(229, 56, 59, 0.15);
  color: #ff8888;
}

/* Main Area */
.idx-main {
  flex-grow: 1;
  margin-left: 260px;
  padding: 30px;
  min-height: calc(100vh - 60px);
  margin-top: 60px;
  background-color: var(--bg-darkest);
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.tab-content.active {
  display: block;
}

.idx-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
}

.idx-header-info h2 {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--text-white);
  letter-spacing: -0.5px;
}

.idx-header-info p {
  font-size: 0.85rem;
  color: var(--text-gray);
  margin-top: 4px;
}

/* --- UI Containers & Cards --- */
.idx-card {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.idx-card-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-white);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* --- Form Elements --- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-gray);
  white-space: nowrap;
}

/* Ocultar flechitas de subir/bajar número */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-white);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent-red);
}

.form-input::placeholder {
  color: var(--text-muted);
}

/* Buttons */
.btn {
  padding: 10px 16px;
  font-weight: 700;
  font-size: 0.8rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: var(--accent-red);
  color: var(--text-white);
}

.btn-primary:hover {
  background: var(--accent-red-hover);
}

.btn-primary:disabled {
  background: var(--border-color);
  color: var(--text-gray);
  cursor: not-allowed;
}

.btn-secondary {
  background: #1e293b;
  border: 1px solid var(--border-color);
  color: var(--text-gray-light);
}

.btn-secondary:hover {
  background: #334155;
}

.btn-emerald {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--accent-emerald);
}

.btn-emerald:hover {
  background: rgba(16, 185, 129, 0.2);
}

/* --- Sales / POS CSS --- */
.pos-wrapper {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (min-width: 1024px) {
  .pos-wrapper {
    flex-direction: row;
    height: calc(100vh - 140px);
  }
}

.pos-products-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #090d1a;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.pos-filter-bar {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

.pos-search-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.pos-search-wrapper {
  position: relative;
  flex-grow: 1;
}

.pos-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-gray);
  font-size: 1rem;
}

.pos-search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-white);
  font-size: 0.8rem;
}

.pos-category-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}

/* Hide scrollbar */
.pos-category-scroll::-webkit-scrollbar {
  display: none;
}

.pos-category-btn {
  padding: 5px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-gray);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.pos-category-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.pos-category-btn.active {
  background: var(--text-gray-light);
  color: var(--bg-darkest);
  border-color: var(--text-gray-light);
}

.pos-products-grid {
  flex-grow: 1;
  overflow-y: auto;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

/* Hide scrollbar on grid */
.pos-products-grid::-webkit-scrollbar {
  display: none;
}

.pos-product-card {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100px;
  position: relative;
}

.pos-product-card:hover {
  border-color: var(--accent-red);
}

.pos-product-name {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-white);
  line-height: 1.2;
}

.pos-product-category {
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--text-gray);
  text-transform: uppercase;
  margin-top: 3px;
  letter-spacing: 0.5px;
}

.pos-product-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 12px;
}

.pos-product-price {
  font-size: 0.8rem;
  font-weight: 900;
  color: var(--text-white);
}

.pos-product-plus-btn {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--border-color);
  color: var(--text-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  font-size: 0.85rem;
  font-weight: 900;
}

.pos-product-card:hover .pos-product-plus-btn {
  background: var(--accent-red);
  color: var(--text-white);
}

/* POS Cart / Sidebar */
.pos-cart-panel {
  width: 100%;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (min-width: 1024px) {
  .pos-cart-panel {
    width: 320px;
    height: 100%;
  }
}

.pos-cart-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.pos-cart-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-white);
  display: flex;
  align-items: center;
}

.pos-cart-badge {
  background: var(--border-color);
  color: var(--text-white);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

.pos-cart-items {
  flex-grow: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 80px;
}

.pos-cart-empty {
  margin: auto;
  text-align: center;
  color: var(--text-gray);
  font-size: 0.75rem;
  font-weight: 500;
}

.pos-cart-item {
  background: var(--bg-darkest);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.pos-cart-item-info {
  flex: 1;
}

.pos-cart-item-name {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-white);
  line-height: 1.25;
}

.pos-cart-item-variant {
  font-size: 0.65rem;
  color: var(--text-gray);
  margin-top: 2px;
}

.pos-cart-item-price {
  font-size: 0.75rem;
  font-weight: 900;
  color: var(--text-white);
  margin-top: 4px;
}

.pos-cart-item-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.pos-cart-item-delete {
  background: transparent;
  border: none;
  color: var(--text-gray);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 2px;
}

.pos-cart-item-delete:hover {
  color: var(--accent-red);
}

.pos-qty-control {
  display: flex;
  align-items: center;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px;
}

.pos-qty-btn {
  background: transparent;
  border: none;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-gray);
  font-size: 0.7rem;
  cursor: pointer;
  border-radius: 3px;
}

.pos-qty-btn:hover {
  background: var(--border-color);
  color: var(--text-white);
}

.pos-qty-input {
  width: 32px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text-white);
  padding: 0;
}

.pos-qty-input:focus {
  outline: none;
}

/* Remove spin buttons */
.pos-qty-input::-webkit-outer-spin-button,
.pos-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.pos-qty-stock-alert {
  font-size: 0.55rem;
  color: var(--text-gray);
  margin-top: 2px;
}

.pos-cart-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-dark);
  flex-shrink: 0;
}

.pos-cart-extras-container {
  flex-shrink: 0;
}

.pos-cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 14px;
}

.pos-cart-total-label {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-gray);
  letter-spacing: 1px;
}

.pos-cart-total-value {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text-white);
}

.pos-cart-cobrar-btn {
  width: 100%;
  padding: 12px;
  background: var(--accent-red);
  color: var(--text-white);
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.8rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pos-cart-cobrar-btn:hover:not(:disabled) {
  background: var(--accent-red-hover);
}

.pos-cart-cobrar-btn:disabled {
  background: var(--border-color);
  color: var(--text-gray);
  cursor: not-allowed;
}

/* --- Tables --- */
.table-wrapper {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.idx-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.idx-table th {
  background: #090d1a;
  padding: 12px 16px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-gray);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.idx-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-white);
  vertical-align: middle;
}

.idx-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.015);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  border: 1px solid transparent;
}

.badge-gray {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-color);
  color: var(--text-gray);
}

.badge-red {
  background: rgba(229, 56, 59, 0.1);
  border-color: rgba(229, 56, 59, 0.2);
  color: #f87171;
}

.badge-emerald {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.2);
  color: var(--accent-emerald);
}

.badge-blue {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.2);
  color: var(--accent-blue);
}

/* Action Groups */
.actions-cell {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.btn-action {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.8rem;
}

.btn-action:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-white);
}

.btn-action.btn-delete:hover {
  border-color: var(--accent-red);
  color: var(--accent-red);
  background: rgba(229, 56, 59, 0.05);
}

/* --- Modals --- */
.modal-backdrop, .modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 16px;
}

.modal-backdrop.active, .modal-overlay.active {
  display: flex;
}

.modal-content, .modal-card {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
  animation: scaleIn 0.2s ease-out;
  overflow: hidden;
}

.modal-content.max-w-2xl {
  max-width: 650px;
}

.modal-content.max-w-sm {
  max-width: 380px;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-white);
}

.modal-close-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-gray);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
}

.modal-close-btn:hover {
  color: var(--text-white);
}

.modal-body {
  padding: 20px;
  max-height: 70vh;
  overflow-y: auto;
}

/* Hide scrollbar */
.modal-body::-webkit-scrollbar {
  display: none;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* --- Dashboard / Panel Controls --- */
.dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 90px;
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kpi-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-gray);
}

.kpi-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.kpi-icon.emerald { color: var(--accent-emerald); background: rgba(16, 185, 129, 0.08); }
.kpi-icon.orange { color: #f97316; background: rgba(249, 115, 22, 0.08); }
.kpi-icon.blue { color: var(--accent-blue); background: rgba(59, 130, 246, 0.08); }
.kpi-icon.rose { color: var(--accent-red); background: rgba(229, 56, 59, 0.08); }

.kpi-value {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--text-white);
  margin-top: 8px;
  white-space: nowrap;
}

.kpi-desc {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 600;
}

@media (max-width: 1280px) {
  .kpi-value {
    font-size: 1rem;
  }
}

@media (max-width: 1024px) {
  .kpi-value {
    font-size: 0.82rem;
  }
  .kpi-card {
    padding: 8px 6px;
  }
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (min-width: 1024px) {
  .charts-grid {
    grid-template-columns: 2fr 1fr;
  }
}

.chart-card-wrapper {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  height: 360px;
  display: flex;
  flex-direction: column;
}

.chart-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.chart-card-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-white);
}

.chart-container {
  flex-grow: 1;
  position: relative;
  height: 0;
  min-height: 0;
  overflow: hidden;
}

.chart-container canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
}

/* --- Gastos SVG Donut Chart --- */
.gastos-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 1024px) {
  .gastos-layout {
    grid-template-columns: 1fr 2fr;
  }
}

.donut-chart-card {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

@media (min-width: 640px) {
  .donut-chart-card {
    flex-direction: row;
    gap: 48px;
  }
}

.donut-svg-wrapper {
  position: relative;
  width: 160px;
  height: 160px;
}

.donut-svg-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.donut-svg-inner {
  width: 100px;
  height: 100px;
  background: var(--bg-dark);
  border-radius: 50%;
}

.donut-info-block {
  text-align: center;
}

@media (min-width: 640px) {
  .donut-info-block {
    text-align: left;
  }
}

.donut-legend-marker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent-red);
}

.donut-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-red);
}

.donut-info-title {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--text-white);
  margin-top: 8px;
}

.donut-info-desc {
  font-size: 0.75rem;
  color: var(--text-gray);
  margin-top: 8px;
  line-height: 1.4;
}

/* Period pill button select */
.period-pill-select {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 3px;
}

.period-pill-btn {
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-gray);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.period-pill-btn.active {
  background: var(--accent-red);
  color: var(--text-white);
}

/* --- Utility / Custom Flex Grids (matching JSX tailwind utilities) --- */
.flex-row-gap-2 { display: flex; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.flex-wrap-gap-1 { display: flex; flex-wrap: wrap; gap: 6px; }

/* Custom Switch Toggle */
.custom-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.custom-switch input {
  display: none;
}

.custom-switch-slider {
  width: 36px;
  height: 20px;
  background: #334155;
  border-radius: 12px;
  position: relative;
  transition: all 0.2s ease;
}

.custom-switch-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-white);
  top: 3px;
  left: 3px;
  transition: all 0.2s ease;
}

.custom-switch input:checked + .custom-switch-slider {
  background: var(--accent-red);
}

.custom-switch input:checked + .custom-switch-slider::before {
  left: 19px;
}

/* Toast */
.idx-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  padding: 14px 20px;
  border-radius: 8px;
  color: var(--text-white);
  font-weight: 600;
  font-size: 0.8rem;
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.idx-toast.active {
  transform: translateY(0);
  opacity: 1;
}

.idx-toast.error {
  border-color: var(--accent-red);
}

.idx-toast.success {
  border-color: var(--accent-emerald);
}

/* Keyframes */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

/* Compras e Ingresos Layout & Components */
.compras-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 1024px) {
  .compras-layout {
    grid-template-columns: 1.2fr 1fr;
  }
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

.autocomplete-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-gray-light);
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  transition: background 0.2s;
}

.autocomplete-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.supplier-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  transition: border-color 0.2s;
}

.supplier-card:hover {
  border-color: var(--border-hover);
}

/* --- Topbar --- */
.app-topbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 60px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1000;
}

.topbar-left {
  display: flex;
  align-items: center;
}

.topbar-logo {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 220px;
}

.logo-sub {
  font-size: 0.55rem;
  color: var(--accent-red);
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: lowercase;
  line-height: 1;
  margin-bottom: 2px;
  display: block;
}

.logo-main {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--accent-blue);
  text-transform: lowercase;
  letter-spacing: -0.5px;
  margin: 0;
  line-height: 1;
}

.topbar-divider {
  width: 1px;
  height: 24px;
  background-color: var(--border-color);
  margin: 0 20px;
}

.topbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-white);
}

.topbar-right {
  display: flex;
  align-items: center;
}

/* --- Notifications --- */
.notification-bell-container {
  position: relative;
  display: inline-block;
}

.btn-bell {
  background: none;
  border: none;
  color: var(--text-gray-light);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
}

.btn-bell:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-white);
}

.bell-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  background-color: var(--accent-red);
  border-radius: 50%;
  border: 1.5px solid var(--bg-dark);
}

.notifications-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 320px;
  background-color: #0d121f;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 1100;
  margin-top: 8px;
  overflow: hidden;
}

.notifications-dropdown.active {
  display: block;
}

.dropdown-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--text-white);
  display: flex;
  align-items: center;
}

.dropdown-body {
  max-height: 360px;
  overflow-y: auto;
}

.notification-item {
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  transition: background-color 0.2s ease;
}

.notification-item:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-icon-wrapper {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notification-icon-wrapper.warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.notification-icon-wrapper.success {
  background-color: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.notification-icon-wrapper.info {
  background-color: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
}

.notification-content {
  flex-grow: 1;
  padding-right: 16px;
}

.notification-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-white);
  margin-bottom: 3px;
}

.notification-text {
  font-size: 0.72rem;
  color: var(--text-gray-light);
  line-height: 1.35;
}

.notification-text strong {
  color: var(--text-white);
}

.btn-dismiss-notification {
  background: none;
  border: none;
  color: var(--text-gray);
  cursor: pointer;
  padding: 4px;
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 0.7rem;
  transition: color 0.2s ease;
  line-height: 1;
}

.btn-dismiss-notification:hover {
  color: var(--text-white);
}

.no-notifications {
  padding: 24px;
  text-align: center;
  color: var(--text-gray);
  font-size: 0.75rem;
}

