:root {
  --bantic-black: #1a1a1a;
  --bantic-orange: #e8843c;
  --bantic-orange-dark: #c56a28;
  --bantic-orange-soft: rgba(232, 132, 60, 0.12);

  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #f1efe8;
  --border: rgba(26, 26, 26, 0.12);
  --border-strong: rgba(26, 26, 26, 0.22);
  --text: #1a1a1a;
  --text-secondary: #5f5e5a;
  --text-tertiary: #908f88;
  --success: #1d7e4a;
  --danger: #c0392b;

  --radius: 7px;
  --radius-lg: 10px;
  --sidebar-w: 215px;
}

* { box-sizing: border-box; }

/* Escala global: 1rem = 14.5px reduce de forma uniforme paddings y márgenes
   expresados en rem, reproduciendo el efecto de un zoom ~90% pero permanente. */
html { font-size: 14.5px; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--bantic-orange); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-weight: 600; margin: 0; }

/* ---------- Logo ---------- */
.bantic-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.bantic-mark {
  width: 26px; height: 26px;
  border: 2.5px solid currentColor;
  border-radius: 2px;
  position: relative;
  flex-shrink: 0;
}
.bantic-mark::after {
  content: "";
  position: absolute;
  right: -2px; bottom: -2px;
  width: 11px; height: 11px;
  background: var(--bantic-orange);
}
.bantic-wordmark { line-height: 1; }
.bantic-wordmark b { font-weight: 600; font-size: 15px; letter-spacing: 0.5px; }
.bantic-wordmark span { font-size: 9px; color: var(--bantic-orange); letter-spacing: 2px; display: block; }

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

/* Colapso del menú lateral en escritorio (control manual con el botón) */
.app.sidebar-collapsed .sidebar { width: 0; min-width: 0; overflow: hidden; border: none; }
.app.sidebar-collapsed .sidebar > * { display: none; }
.sidebar { transition: width 0.18s ease; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--bantic-black);
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-head {
  padding: 1rem;
  border-bottom: 0.5px solid rgba(255,255,255,0.12);
  color: #fff;
}
.sidebar-section {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  padding: 14px 1rem 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.menu-area {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 1rem;
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  border-left: 3px solid transparent;
  background: none; border: none; width: 100%; text-align: left;
}
.menu-area:hover { background: rgba(255,255,255,0.06); color: #fff; }
.menu-area.active {
  background: var(--bantic-orange-soft);
  border-left-color: var(--bantic-orange);
  color: #fff;
}
.menu-area i:first-child { font-size: 17px; }
.menu-area .chev { margin-left: auto; font-size: 13px; transition: transform 0.15s; }
.menu-area.open .chev { transform: rotate(90deg); }

.menu-tableros { display: none; padding: 2px 0 6px; }
.menu-tableros.open { display: block; }
.menu-tablero {
  display: block;
  padding: 6px 1rem 6px 2.6rem;
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  border-left: 3px solid transparent;
}
.menu-tablero:hover { color: #fff; text-decoration: none; background: rgba(255,255,255,0.05); }
.menu-tablero.active {
  color: #fff;
  background: rgba(255,255,255,0.07);
  border-left-color: var(--bantic-orange);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.55rem 1.25rem;
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.empresa-selector {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 6px 10px;
}
.empresa-selector i { color: var(--bantic-orange); font-size: 15px; }
.empresa-selector select { border: none; background: transparent; font-size: 12px; font-weight: 600; cursor: pointer; }

.moneda-selector { display: flex; align-items: center; }
.moneda-selector select {
  border: 0.5px solid var(--border); background: var(--surface-2);
  border-radius: var(--radius); padding: 5px 8px;
  font-size: 12px; font-weight: 600; cursor: pointer; color: var(--text-primary);
}
.moneda-selector:empty { display: none; }

.user-chip { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 27px; height: 27px; border-radius: 50%;
  background: var(--bantic-orange); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
}

.content { padding: 1.15rem 1.25rem; flex: 1; }

/* ---------- Componentes ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 12px; cursor: pointer;
  transition: background 0.15s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--bantic-orange); border-color: var(--bantic-orange); color: #fff; }
.btn-primary:hover { background: var(--bantic-orange-dark); }
.btn-sm { height: 25px; font-size: 11px; padding: 0 9px; }

.spinner-inline {
  display: inline-block; width: 11px; height: 11px;
  border: 1.5px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: bantic-spin 0.6s linear infinite; vertical-align: -1px;
}
@keyframes bantic-spin { to { transform: rotate(360deg); } }

.card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1rem;
}
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }

.kpi {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem;
  position: relative;
}
.kpi-label { font-size: 11px; color: var(--text-secondary); margin: 0 0 4px; }
.kpi-value { font-size: 19px; font-weight: 600; margin: 0; }
.kpi-delta { font-size: 10.5px; margin: 4px 0 0; }
.kpi-delta.up { color: var(--success); }
.kpi-delta.down { color: var(--danger); }
.kpi-menu-btn { position: absolute; top: 10px; right: 8px; color: var(--bantic-orange); cursor: pointer; background: none; border: none; font-size: 15px; }

.area-card {
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.9rem;
  display: block;
  color: var(--text);
  transition: border-color 0.15s, transform 0.1s;
}
.area-card:hover { border-color: var(--bantic-orange); text-decoration: none; transform: translateY(-1px); }
.area-card i { font-size: 20px; color: var(--bantic-orange); }
.area-card .nombre { font-weight: 600; font-size: 13px; margin: 7px 0 2px; }
.area-card .meta { font-size: 11px; color: var(--text-secondary); margin: 0; }

/* ---------- Filtros ---------- */
.filtros {
  background: var(--surface-2);
  border-left: 3px solid var(--bantic-orange);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 1.25rem;
}
.filtros-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.filtros-head i { color: var(--bantic-orange); }
.filtros-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.filtro label { font-size: 10px; color: var(--text-tertiary); display: block; margin-bottom: 3px; text-transform: uppercase; }
.filtro select, .filtro input {
  width: 100%; height: 34px;
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0 8px; font-size: 12px; background: var(--surface);
}
.chips { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.chip {
  font-size: 11px; background: var(--bantic-black); color: #fff;
  padding: 4px 10px; border-radius: 20px;
  display: flex; align-items: center; gap: 5px;
}
.chip i { font-size: 12px; color: var(--bantic-orange); cursor: pointer; }

/* ---------- Forms ---------- */
input[type=text], input[type=password], input[type=email], select, textarea {
  height: 34px;
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0 9px;
  font-size: 12.5px;
  background: var(--surface);
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--bantic-orange);
  box-shadow: 0 0 0 3px var(--bantic-orange-soft);
}
label.field { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 5px; }

table.data { width: 100%; border-collapse: collapse; font-size: 12px; }
table.data th { text-align: left; padding: 7px 9px; background: var(--surface-2); font-weight: 600; border-bottom: 0.5px solid var(--border); }
table.data td { padding: 7px 9px; border-bottom: 0.5px solid var(--border); }

.badge { font-size: 10.5px; padding: 3px 8px; border-radius: var(--radius); }
.badge-success { background: #e7f5ec; color: var(--success); }
.badge-muted { background: var(--surface-2); color: var(--text-secondary); }

.alert-error {
  background: #fdeceb; border: 0.5px solid #f0b4b0; color: var(--danger);
  padding: 9px 11px; border-radius: var(--radius); font-size: 12px; margin-bottom: 1rem;
}

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.1rem; flex-wrap: wrap; gap: 10px; }
.breadcrumb { font-size: 10.5px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }

/* ---------- Dropdown export ---------- */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  display: none; position: absolute; right: 0; top: 100%;
  background: var(--surface); border: 0.5px solid var(--border-strong);
  border-radius: var(--radius); padding: 5px; min-width: 180px; z-index: 20;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-item { display: flex; align-items: center; gap: 9px; padding: 8px 9px; font-size: 12px; border-radius: var(--radius); cursor: pointer; color: var(--text); }
.dropdown-item:hover { background: var(--surface-2); text-decoration: none; }

/* ---------- Mobile ---------- */
/* El botón de menú es visible siempre: en escritorio colapsa el sidebar, en móvil lo abre/cierra */
.menu-toggle { display: block; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-secondary); }
.menu-toggle:hover { color: var(--bantic-orange); }
@media (max-width: 860px) {
  /* En móvil el sidebar colapsado por CSS de escritorio no aplica: usa el modo deslizante */
  .app.sidebar-collapsed .sidebar { width: var(--sidebar-w); }
  .app.sidebar-collapsed .sidebar > * { display: revert; }
  .sidebar { position: fixed; left: -100%; z-index: 100; transition: left 0.2s; }
  .sidebar.open { left: 0; }
  .card-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
  .tablero-charts { grid-template-columns: 1fr !important; }
}
