/* ═══════════════════════════════════════
   Orders Manager — Styles
   ═══════════════════════════════════════ */

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #09090b;
  --surface: #111113;
  --surface-alt: #18181b;
  --sidebar-bg: #0c0c0e;
  --border: rgba(255,255,255,0.06);
  --border-light: rgba(255,255,255,0.04);
  --text: #fafafa;
  --text-sec: #a1a1aa;
  --text-dim: #71717a;
  --text-mute: #52525b;
  --text-ghost: #3f3f46;
  --text-invis: #27272a;
  --accent: #10B981;
  --accent-bg: rgba(16,185,129,0.08);
  --godoy: #DC2626;
  --godoy-bg: rgba(220,38,38,0.08);
  --godoy-border: rgba(220,38,38,0.18);
  --shield: #D4A017;
  --shield-bg: rgba(212,160,23,0.08);
  --shield-border: rgba(212,160,23,0.18);
}

body {
  font-family: 'SF Pro Display', -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

#root { display: flex; min-height: 100vh; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-invis); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-ghost); }

/* ── Sidebar ── */
.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width 0.22s ease;
  overflow: hidden;
}
.sidebar.collapsed { width: 52px; }

.sidebar-store-section {
  padding: 14px 10px;
  border-bottom: 1px solid var(--border);
}
.collapsed .sidebar-store-section { padding: 14px 8px; }

/* Store switch buttons */
.store-switch {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.store-switch-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-ghost);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.store-switch-btn .store-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.store-switch-btn .store-dot {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  margin-left: auto;
  opacity: 0;
  transition: opacity 0.15s;
}

/* Godoy active */
.store-switch-btn.godoy-active {
  border-color: var(--godoy-border);
  background: var(--godoy-bg);
  color: var(--godoy);
  font-weight: 700;
}
.store-switch-btn.godoy-active .store-icon {
  background: var(--godoy-bg);
  border-color: var(--godoy-border);
  color: var(--godoy);
}
.store-switch-btn.godoy-active .store-dot {
  background: var(--godoy);
  opacity: 1;
}

/* Shield active */
.store-switch-btn.shield-active {
  border-color: var(--shield-border);
  background: var(--shield-bg);
  color: var(--shield);
  font-weight: 700;
}
.store-switch-btn.shield-active .store-icon {
  background: var(--shield-bg);
  border-color: var(--shield-border);
  color: var(--shield);
}
.store-switch-btn.shield-active .store-dot {
  background: var(--shield);
  opacity: 1;
}

/* Collapsed store buttons */
.store-switch-collapsed {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}
.store-switch-collapsed .store-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--text-ghost);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.store-switch-collapsed .store-icon-btn.godoy-active {
  background: var(--godoy-bg);
  border-color: var(--godoy-border);
  color: var(--godoy);
}
.store-switch-collapsed .store-icon-btn.shield-active {
  background: var(--shield-bg);
  border-color: var(--shield-border);
  color: var(--shield);
}

/* Nav */
.sidebar-nav { padding: 8px 8px; flex: 1; }
.sidebar-nav .nav-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-invis);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 10px 10px 6px;
}
.collapsed .nav-label { display: none; }

.nav-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--text-mute);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.15s;
  margin-bottom: 1px;
}
.collapsed .nav-btn {
  padding: 8px 0;
  justify-content: center;
}
.nav-btn:hover { background: rgba(255,255,255,0.03); }
.nav-btn.active { background: rgba(255,255,255,0.05); color: var(--text-sec); font-weight: 600; }
.nav-btn .nav-icon { font-size: 13px; width: 18px; text-align: center; flex-shrink: 0; }
.collapsed .nav-btn .nav-text { display: none; }

.nav-sep { height: 1px; background: var(--border-light); margin: 6px 4px; }

.nav-btn.add-btn { color: var(--text-mute); }
.nav-btn.add-btn:hover { background: rgba(255,255,255,0.04); }

/* Collapse toggle */
.collapse-btn {
  padding: 12px;
  border: none;
  border-top: 1px solid var(--border-light);
  background: transparent;
  color: var(--text-invis);
  cursor: pointer;
  font-size: 12px;
  transition: color 0.15s;
}
.collapse-btn:hover { color: var(--text-ghost); }

/* ── Main Area ── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--sidebar-bg);
}
.topbar h2 { font-size: 16px; font-weight: 700; flex: 1; }

.search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-mute);
  font-size: 13px;
  cursor: pointer;
  min-width: 200px;
  font-family: inherit;
}
.search-trigger .kbd {
  font-size: 10px;
  background: var(--bg);
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
  color: var(--text-ghost);
}

.status-dot {
  width: 6px; height: 6px;
  border-radius: 3px;
  background: var(--accent);
}

.content { flex: 1; overflow-y: auto; padding: 24px; }

/* ── Stat Cards ── */
.stats-row { display: flex; gap: 12px; margin-bottom: 18px; }
.stat-card {
  padding: 12px 18px;
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.stat-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 13px;
}
.stat-label {
  font-size: 10px;
  color: var(--text-mute);
  font-weight: 600;
  text-transform: uppercase;
}
.stat-value {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

/* ── Filters ── */
.filters-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.filter-spacer { flex: 1; }

.filter-btn, .action-btn {
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.15s;
}
.filter-btn {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  color: var(--text-mute);
}
.filter-btn.has-value {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
  color: var(--text-sec);
}
.action-btn {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text-sec);
}
.action-btn.primary {
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
.clear-btn {
  background: none;
  border: none;
  color: #EF4444;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
}

/* ── Dropdown ── */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 170px;
  z-index: 50;
  background: var(--surface-alt);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
  padding: 4px;
  max-height: 280px;
  overflow-y: auto;
}
.dropdown-item {
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-sec);
  transition: background 0.1s;
}
.dropdown-item:hover { background: rgba(255,255,255,0.04); }
.dropdown-item.active { background: rgba(255,255,255,0.06); color: var(--text); }

/* ── Table ── */
.table-wrap {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.table-scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { border-bottom: 1px solid var(--border); }
th {
  padding: 10px 10px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-ghost);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  white-space: nowrap;
  user-select: none;
}
th.sortable { cursor: pointer; }
th .sort-icon { font-size: 9px; margin-left: 4px; color: var(--text-invis); }
th .sort-icon.active { color: var(--text-sec); }

tbody tr {
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.1s;
}
tbody tr:hover { background: rgba(255,255,255,0.02); }
td { padding: 9px 10px; }

.cell-id { font-family: monospace; font-size: 12px; color: var(--text-sec); font-weight: 600; }
.cell-date { color: var(--text-dim); }
.cell-name { font-weight: 500; color: var(--text); max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-city { color: var(--text-dim); }
.cell-dept { color: var(--text-mute); font-size: 11px; }
.cell-total { font-weight: 700; font-family: monospace; font-size: 12px; color: var(--text); }
.cell-plain { color: var(--text-dim); font-size: 12px; }

.table-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-ghost);
}
.table-footer strong { color: var(--text); }

.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--text-mute);
}
.empty-state i { font-size: 26px; margin-bottom: 8px; display: block; }

/* ── Badges ── */
.store-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.store-badge i { font-size: 8px; }
.store-badge.godoy { background: var(--godoy-bg); color: var(--godoy); border: 1px solid var(--godoy-border); }
.store-badge.shield { background: var(--shield-bg); color: var(--shield); border: 1px solid var(--shield-border); }

.pill {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
  color: var(--text-dim);
  border: 1px solid var(--border);
  letter-spacing: 0.2px;
}
.pills { display: flex; gap: 3px; }

.delete-btn {
  background: none;
  border: none;
  color: var(--text-invis);
  cursor: pointer;
  font-size: 11px;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s;
}
.delete-btn:hover { color: #EF4444; }

/* ── Overlay / Backdrop ── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 90;
  backdrop-filter: blur(3px);
}
.overlay-dark {
  background: rgba(0,0,0,0.7);
  z-index: 100;
  backdrop-filter: blur(6px);
}

/* ── Command Palette ── */
.cmd-palette {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 120px;
  z-index: 100;
}
.cmd-box {
  width: 100%;
  max-width: 520px;
  background: var(--surface-alt);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.8);
}
.cmd-input-wrap {
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}
.cmd-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  padding: 14px 12px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}
.cmd-results { padding: 6px; max-height: 360px; overflow-y: auto; }
.cmd-label { padding: 8px 12px; font-size: 10px; font-weight: 700; color: var(--text-ghost); text-transform: uppercase; letter-spacing: 1px; }
.cmd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
}
.cmd-item.focused { background: rgba(255,255,255,0.05); }
.cmd-item-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}
.cmd-item-icon.action { background: var(--accent-bg); color: var(--accent); }
.cmd-empty { padding: 24px; text-align: center; color: var(--text-mute); font-size: 13px; }

/* ── Slide Panel (Order Form) ── */
.slide-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 440px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  z-index: 91;
  animation: slideIn 0.2s ease;
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }

.panel-header {
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-header-info { display: flex; align-items: center; gap: 11px; }
.panel-store-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.panel-title { font-size: 15px; font-weight: 700; }
.panel-subtitle { font-size: 11px; font-weight: 600; margin-top: 1px; }
.panel-close {
  background: none;
  border: none;
  color: var(--text-mute);
  cursor: pointer;
  font-size: 15px;
  padding: 4px;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.panel-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
}

/* Form elements */
.form-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-mute);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.form-input, .form-select {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.form-select { cursor: pointer; }
.form-select:disabled { opacity: 0.4; cursor: not-allowed; }
.form-input::placeholder { color: var(--text-ghost); }
.form-input:focus, .form-select:focus { border-color: rgba(255,255,255,0.12); }
.form-input.readonly { color: var(--text-ghost); }
.form-input.auto-filled { color: var(--accent); }

.form-row { display: flex; gap: 10px; }
.form-col { flex: 1; }
.form-section { border-top: 1px solid var(--border-light); padding-top: 14px; }
.form-section-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-ghost);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

/* Product counter */
.product-counters { display: flex; gap: 8px; }
.product-card {
  flex: 1;
  background: rgba(255,255,255,0.02);
  border-radius: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  text-align: center;
}
.product-name { font-size: 11px; font-weight: 700; color: var(--text-dim); margin-bottom: 6px; }
.product-counter { display: flex; align-items: center; justify-content: center; gap: 8px; }
.counter-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  transition: all 0.15s;
}
.counter-btn.plus { /* colored by JS per store */ }
.counter-value { font-size: 20px; font-weight: 800; min-width: 24px; }
.product-price { font-size: 10px; color: var(--text-ghost); margin-top: 4px; }

/* Total box */
.total-box {
  border-radius: 10px;
  padding: 14px;
}
.total-input {
  width: 100%;
  font-size: 22px;
  font-weight: 800;
  background: transparent;
  border: none;
  padding: 0;
  font-family: monospace;
  outline: none;
}
.total-hint { font-size: 10px; color: var(--text-mute); margin-top: 4px; }

/* Store selector in form */
.store-selector { display: flex; gap: 8px; }
.store-select-btn {
  flex: 1;
  padding: 9px 12px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.15s;
  font-family: inherit;
  background: rgba(255,255,255,0.02);
  border: 1.5px solid var(--border);
  color: var(--text-mute);
}

/* Form buttons */
.btn-cancel {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-save {
  flex: 2;
  padding: 10px;
  border-radius: 8px;
  border: none;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

/* ── Import Modal ── */
.modal-box {
  width: 540px;
  background: var(--surface-alt);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  overflow: hidden;
}
.modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 15px; font-weight: 700; }
.modal-body { padding: 22px; }

.drop-zone {
  border: 2px dashed rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  background: rgba(255,255,255,0.02);
  transition: border-color 0.2s;
}
.drop-zone:hover { border-color: rgba(255,255,255,0.2); }
.drop-zone i { font-size: 28px; color: var(--text-mute); margin-bottom: 12px; }

.preview-table { overflow-x: auto; border-radius: 8px; border: 1px solid var(--border); }
.preview-table table { width: 100%; font-size: 11px; }
.preview-table th { background: rgba(255,255,255,0.02); color: var(--text-mute); font-weight: 700; text-transform: uppercase; }
.preview-table td { border-top: 1px solid var(--border-light); color: var(--text-sec); }

/* ── Dashboard / Resumen ── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.kpi-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 16px 18px;
  border: 1px solid var(--border);
}
.kpi-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.kpi-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 13px;
}
.kpi-label { font-size: 10px; color: var(--text-mute); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-value { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }

.chart-grid { display: grid; gap: 12px; margin-bottom: 12px; }
.chart-grid.two-col { grid-template-columns: 2fr 1fr; }
.chart-grid.equal { grid-template-columns: 1fr 1fr; }
.chart-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 18px;
  border: 1px solid var(--border);
}
.chart-title { font-size: 13px; font-weight: 700; margin-bottom: 14px; }
.chart-title i { margin-right: 8px; color: var(--text-dim); }

.city-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.city-rank { font-size: 12px; font-weight: 700; color: var(--text-ghost); width: 18px; }
.city-name { flex: 1; font-size: 13px; color: var(--text-sec); }
.city-bar { width: 80px; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.05); overflow: hidden; }
.city-bar-fill { height: 100%; border-radius: 3px; background: var(--text-dim); }
.city-count { font-size: 12px; font-weight: 600; color: var(--text-mute); width: 24px; text-align: right; }

.payment-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.payment-count {
  width: 38px; height: 38px;
  border-radius: 9px;
  background: rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 800;
  color: var(--text-sec);
}
.payment-label { font-size: 13px; font-weight: 600; color: var(--text-sec); }
.payment-pct { font-size: 11px; color: var(--text-mute); }

.pie-legend { display: flex; justify-content: center; gap: 16px; margin-top: 8px; }
.pie-legend-item { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-sec); }
.pie-legend-dot { width: 8px; height: 8px; border-radius: 2px; }