/* ============================================================
   ERP BELLI — Global Styles
   Font: Inter (loaded in index.html via Google Fonts)
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

@keyframes spin { to { transform: rotate(360deg); } }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f8fafc;
  color: #0f172a;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- LOGIN ---- */
#login-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: #f8fafc;
}
.login-card {
  background: #fff; border-radius: 16px; padding: 44px 48px;
  width: 400px; box-shadow: 0 4px 24px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.04);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-axon-name {
  font-size: 36px; font-weight: 800; color: #0f172a;
  letter-spacing: -1.5px; line-height: 1; margin-bottom: 6px;
}
.login-belli-badge {
  font-size: 13px; font-weight: 600; color: #94a3b8;
  letter-spacing: 0.3px; margin-bottom: 8px;
}
.login-logo p { color: #94a3b8; font-size: 13px; margin-top: 0; font-weight: 400; }
.login-group { margin-bottom: 16px; }
.login-group label {
  display: block; font-weight: 600; margin-bottom: 6px;
  color: #475569; font-size: 12px; letter-spacing: .3px;
}
.login-group input {
  width: 100%; border: 1.5px solid #e2e8f0; border-radius: 9px;
  padding: 11px 14px; font-size: 14px; outline: none;
  font-family: inherit; transition: border-color .2s, box-shadow .2s;
  color: #0f172a;
}
.login-group input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.btn-login {
  width: 100%; background: #2563eb; color: #fff; border: none;
  border-radius: 9px; padding: 12px; font-size: 14px; font-weight: 700;
  cursor: pointer; margin-top: 8px; transition: background .2s, transform .1s;
  font-family: inherit; letter-spacing: .2px;
}
.btn-login:hover { background: #1d4ed8; }
.btn-login:active { transform: scale(.99); }
.login-error { color: #dc2626; font-size: 12px; text-align: center; margin-top: 12px; display: none; }

/* ---- APP SHELL ---- */
#app { display: none; flex-direction: column; min-height: 100vh; }

header {
  background: #118def; border-bottom: none;
  padding: 0 28px; height: 58px; display: flex;
  align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(18,150,216,.25);
}
.header-logo { display: flex; align-items: baseline; gap: 8px; }
.header-belli-name {
  font-size: 20px; font-weight: 800; color: #fff;
  letter-spacing: 2px; font-family: 'Inter', sans-serif;
}
.header-axon-label {
  font-size: 11px; font-weight: 600;
  color: rgba(255,255,255,0.6); letter-spacing: 0.5px;
}
.header-right { display: flex; align-items: center; gap: 10px; }
.user-badge {
  background: rgba(255,255,255,0.18); border-radius: 20px; padding: 5px 14px;
  font-size: 12px; font-weight: 600; color: #fff;
}
.btn-logout {
  background: none; border: 1.5px solid rgba(255,255,255,0.35); border-radius: 7px;
  padding: 5px 12px; font-size: 12px; cursor: pointer; color: #fff;
  font-family: inherit; font-weight: 600; transition: all .2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.6); }
.btn-data-tool {
  background: rgba(255,255,255,0.1); border: 1.5px solid rgba(255,255,255,0.25); border-radius: 7px;
  padding: 5px 10px; font-size: 11px; cursor: pointer; color: rgba(255,255,255,0.85);
  font-family: inherit; font-weight: 500; transition: all .2s;
}
.btn-data-tool:hover { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.5); color: #fff; }

/* ---- SIDEBAR ---- */
.app-body { display: flex; flex: 1; overflow: hidden; }
.sidebar {
  width: 224px; background: #fff; border-right: 1px solid #e2e8f0;
  padding: 12px 0 20px; flex-shrink: 0; overflow-y: auto;
}
.sidebar-label {
  padding: 12px 18px 4px; font-size: 10px; text-transform: uppercase;
  letter-spacing: 1px; color: #94a3b8; font-weight: 700;
}
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px; cursor: pointer; color: #475569;
  font-weight: 500; font-size: 13px; transition: all .15s;
  border-left: 3px solid transparent; user-select: none;
  border-radius: 0;
}
.sidebar-item:hover { background: #f8fafc; color: #0f172a; }
.sidebar-item.active {
  background: #eff6ff; color: #2563eb;
  border-left-color: #2563eb; font-weight: 600;
}
.sidebar-item .icon { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }

/* ---- MAIN ---- */
main { flex: 1; padding: 28px; overflow-y: auto; }
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px;
}
.page-title { font-size: 20px; font-weight: 800; color: #0f172a; letter-spacing: -0.5px; }
.page-subtitle { font-size: 12px; color: #94a3b8; margin-top: 3px; font-weight: 400; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; border: none;
  cursor: pointer; font-size: 12px; font-weight: 600;
  font-family: inherit; transition: all .18s; white-space: nowrap;
}
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; box-shadow: 0 2px 8px rgba(37,99,235,.3); }
.btn-secondary { background: #f1f5f9; color: #475569; border: 1.5px solid #e2e8f0; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger { background: #fff1f2; color: #dc2626; border: 1.5px solid #fecdd3; }
.btn-danger:hover { background: #fee2e2; }
.btn-success { background: #ecfdf5; color: #059669; border: 1.5px solid #a7f3d0; }
.btn-success:hover { background: #d1fae5; }
.btn-sm { padding: 5px 10px; font-size: 11px; border-radius: 6px; }
.btn-ghost { background: none; border: none; color: #94a3b8; padding: 4px 8px; }
.btn-ghost:hover { background: #f1f5f9; color: #475569; }

/* ---- KPI CARDS ---- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 14px; margin-bottom: 24px; }
.kpi-card {
  background: #fff; border-radius: 12px; padding: 18px 20px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.kpi-label { font-size: 11px; color: #94a3b8; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.kpi-value { font-size: 22px; font-weight: 800; margin-top: 6px; color: #0f172a; letter-spacing: -0.5px; }
.kpi-value.green { color: #059669; }
.kpi-value.red { color: #dc2626; }
.kpi-value.blue { color: #2563eb; }
.kpi-value.orange { color: #d97706; }
.kpi-sub { font-size: 11px; color: #94a3b8; margin-top: 3px; }

/* ---- TABLE ---- */
.table-wrap {
  background: #fff; border-radius: 12px;
  border: 1px solid #e2e8f0; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.table-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid #f1f5f9; gap: 12px;
}
.table-toolbar-left { display: flex; align-items: center; gap: 10px; }
.table-search {
  border: 1.5px solid #e2e8f0; border-radius: 8px; padding: 7px 12px;
  font-size: 12px; outline: none; width: 220px; font-family: inherit;
  transition: border-color .2s;
}
.table-search:focus { border-color: #2563eb; }
.table-count { font-size: 12px; color: #94a3b8; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: #f8fafc; }
/* Tabla con scroll propio y encabezados fijos */
.table-scroll-body {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 320px);
}
.table-scroll-body thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
}
th {
  padding: 10px 16px; text-align: left; font-size: 11px;
  font-weight: 700; color: #64748b; text-transform: uppercase;
  letter-spacing: .5px; border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}
td {
  padding: 11px 16px; border-bottom: 1px solid #f1f5f9;
  color: #334155; vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr { cursor: pointer; transition: background .12s; }
tbody tr:hover td { background: #f8fafc; }
.td-num { text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 500; }
.td-actions { white-space: nowrap; text-align: right; }
.td-actions .btn { margin-left: 4px; }

/* ---- BADGES ---- */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-gray { background: #f1f5f9; color: #64748b; }
.badge-purple { background: #ede9fe; color: #6d28d9; }

/* ---- MODAL ---- */
#modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,.5); z-index: 200;
  align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}
#modal-overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: 16px; padding: 28px 32px;
  width: 560px; max-width: 96vw; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,.18);
  animation: modalIn .18s ease;
}
@keyframes modalIn { from { opacity:0; transform:translateY(8px) scale(.98); } to { opacity:1; transform:translateY(0) scale(1); } }
.modal-sm { width: 420px; }
.modal-lg { width: 700px; }
.modal-xl { width: 820px; }
.modal h2 { font-size: 17px; font-weight: 800; margin-bottom: 22px; color: #0f172a; letter-spacing: -0.3px; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-grid .full { grid-column: 1 / -1; }
.form-group label {
  display: block; font-size: 11px; font-weight: 600; color: #64748b;
  text-transform: uppercase; letter-spacing: .4px; margin-bottom: 5px;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%; border: 1.5px solid #e2e8f0; border-radius: 8px;
  padding: 9px 11px; font-size: 13px; outline: none;
  transition: border-color .2s, box-shadow .2s; font-family: inherit; color: #0f172a;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}
.form-group input[readonly] { background: #f8fafc; color: #64748b; cursor: default; }
.form-group textarea { resize: vertical; min-height: 64px; }
.comprobante-resumen {
  display: flex; gap: 20px; flex-wrap: wrap;
  padding: 10px 14px; background: #f1f5f9; border-radius: 8px;
  font-size: 12px; color: #475569; align-items: center;
}
.comprobante-resumen strong { color: #0f172a; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 22px; padding-top: 16px; border-top: 1px solid #f1f5f9;
}

/* ---- DETAIL MODAL ---- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.detail-item { padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.detail-item.full { grid-column: 1/-1; }
.detail-label { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: #94a3b8; font-weight: 700; margin-bottom: 3px; }
.detail-value { font-size: 14px; font-weight: 600; color: #0f172a; }
.detail-value.amount { font-size: 16px; color: #2563eb; }
.detail-section { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: #94a3b8; padding: 14px 0 6px; grid-column: 1/-1; border-bottom: 1px solid #e2e8f0; margin-bottom: 2px; }

/* ---- SECTION CARDS ---- */
.section-card {
  background: #fff; border-radius: 12px; border: 1px solid #e2e8f0;
  padding: 20px 22px; box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.section-card h3 { font-size: 13px; font-weight: 700; margin-bottom: 14px; color: #475569; }
.resumen-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px;
}
.resumen-row:last-child { border-bottom: none; }
.resumen-row .label { color: #64748b; }
.resumen-row .value { font-weight: 700; font-variant-numeric: tabular-nums; }
.resumen-total {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; margin-top: 8px; font-size: 15px; font-weight: 800; color: #0f172a;
  border-top: 1.5px solid #e2e8f0;
}

/* ---- CHARTS ---- */
.chart-card {
  background: #fff; border-radius: 12px; border: 1px solid #e2e8f0;
  padding: 20px 22px; box-shadow: 0 1px 3px rgba(0,0,0,.04);
  margin-bottom: 16px;
}
.chart-card h3 { font-size: 13px; font-weight: 700; margin-bottom: 16px; color: #475569; }
.chart-container { width: 100%; overflow: hidden; }

/* ---- FILTER BAR ---- */
.filter-bar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.filter-bar label { font-size: 12px; font-weight: 600; color: #64748b; }
.filter-select {
  border: 1.5px solid #e2e8f0; border-radius: 8px; padding: 7px 12px;
  font-size: 12px; font-family: inherit; outline: none; cursor: pointer;
  color: #0f172a; transition: border-color .2s;
}
.filter-select:focus { border-color: #2563eb; }

/* ---- CALENDAR ---- */
.cal-wrap { background: #fff; border-radius: 12px; border: 1px solid #e2e8f0; padding: 20px 22px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cal-nav-title { font-size: 15px; font-weight: 800; color: #0f172a; letter-spacing: -0.3px; }
.cal-nav-btns { display: flex; gap: 6px; }
.cal-dow-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin-bottom: 4px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 700; color: #94a3b8; text-transform: uppercase; padding: 4px 0; }
/* Celda de número de día (nuevo layout con barras externas) */
.cal-dn-cell {
  height: 36px; padding: 6px 8px;
  border-radius: 6px; background: #f8fafc;
  border: 1px solid #f1f5f9;
}
.cal-dn-cell.today { border-color: #2563eb; background: #eff6ff; }
.cal-dn-cell.today .cal-day-num { color: #2563eb; font-weight: 800; }
.cal-dn-empty { background: transparent !important; border-color: transparent !important; }
.cal-day-num { font-size: 12px; font-weight: 600; color: #475569; display: block; }
/* Barra de reserva continua (spanning) */
.cal-event-bar {
  color: #fff; font-size: 11px; font-weight: 600;
  padding: 2px 8px; margin: 1px 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: pointer; line-height: 20px;
  transition: opacity .15s;
  opacity: 0.88;
}
.cal-event-bar:hover { opacity: 1; }

/* ---- EMPTY STATE ---- */
.empty-state { text-align: center; padding: 48px 20px; color: #94a3b8; }
.empty-state .empty-icon { font-size: 32px; margin-bottom: 10px; }
.empty-state p { font-size: 13px; }

/* ---- NO ACCESS ---- */
.no-access { text-align: center; padding: 64px 20px; color: #94a3b8; }
.no-access h3 { font-size: 16px; margin-bottom: 8px; color: #d97706; font-weight: 700; }

/* ---- TABS ---- */
.tabs { display: flex; gap: 2px; background: #f1f5f9; padding: 3px; border-radius: 9px; width: fit-content; margin-bottom: 20px; }
.tab {
  padding: 6px 18px; border-radius: 7px; cursor: pointer; font-size: 12px;
  font-weight: 600; color: #64748b; transition: all .2s; border: none;
  background: none; font-family: inherit;
}
.tab.active { background: #fff; color: #0f172a; box-shadow: 0 1px 4px rgba(0,0,0,.1); }

/* ---- AIRBNB RESUMEN TABLE ---- */
.res-mes-table th, .res-mes-table td { padding: 10px 14px; }

/* ---- CAMP MODULE ---- */
.camp-num {
  width: 100px; padding: 4px 8px; border: 1px solid #e2e8f0; border-radius: 6px;
  font-size: 13px; text-align: right; color: #0f172a; background: #fff; font-family: inherit;
}
.camp-num:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.1); }
.camp-date {
  padding: 4px 6px; border: 1px solid #e2e8f0; border-radius: 6px;
  font-size: 12px; color: #475569; font-family: inherit; background: #fff;
}
.camp-estado {
  padding: 4px 8px; border: 1px solid #e2e8f0; border-radius: 6px;
  font-size: 12px; cursor: pointer; font-family: inherit; background: #fff;
}
.camp-cat-row td { background: #f1f5f9 !important; font-weight: 700; font-size: 12px; color: #334155; padding: 7px 12px !important; }
.camp-sub-row td { background: #f8fafc; font-weight: 600; font-size: 12px; color: #475569; padding: 6px 12px !important; }
.camp-row-pending td:first-child { color: #94a3b8; }
.camp-prog-bar { height: 8px; background: #e2e8f0; border-radius: 999px; width: 110px; overflow: hidden; flex-shrink: 0; }
.camp-prog-fill { height: 100%; background: linear-gradient(90deg,#2563eb,#06b6d4); border-radius: 999px; }
.camp-concepto {
  width: 100%; padding: 3px 6px; border: 1px solid transparent; border-radius: 4px;
  font-size: 13px; color: #0f172a; background: transparent; font-family: inherit;
}
.camp-concepto:hover { border-color: #e2e8f0; }
.camp-concepto:focus { outline: none; border-color: #2563eb; background: #fff; box-shadow: 0 0 0 2px rgba(37,99,235,.1); }
.btn-del-camp {
  background: none; border: none; color: #cbd5e1; font-size: 16px; cursor: pointer;
  padding: 2px 6px; border-radius: 4px; line-height: 1; transition: color .15s, background .15s;
}
.btn-del-camp:hover { color: #ef4444; background: #fef2f2; }
.btn-add-camp {
  background: none; border: 1px dashed #cbd5e1; color: #64748b; font-size: 12px;
  cursor: pointer; padding: 4px 12px; border-radius: 6px; font-family: inherit;
  transition: border-color .15s, color .15s, background .15s;
}
.btn-add-camp:hover { border-color: #2563eb; color: #2563eb; background: #eff6ff; }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ---- HAMBURGER (solo visible en móvil) ---- */
.btn-hamburger {
  display: none; background: none; border: none; color: #fff;
  font-size: 22px; cursor: pointer; padding: 4px 6px; line-height: 1;
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0; top: 58px;
  background: rgba(0,0,0,.45); z-index: 140;
}
.sidebar-overlay.active { display: block; }
.sidebar-logout-mobile { display: none; }
.btn-logout-mobile {
  width: calc(100% - 36px); margin: 12px 18px 4px; padding: 10px;
  background: #fee2e2; color: #dc2626; border: none; border-radius: 8px;
  font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
}

/* ================================================================
   MOBILE — max-width: 768px
   ================================================================ */
@media (max-width: 768px) {

  /* ── Header ── */
  header { padding: 0 16px; }
  .user-badge { display: none; }
  #header-admin-tools { display: none !important; }
  .btn-logout-desktop { display: none; }
  .btn-hamburger { display: flex; }

  /* ── Sidebar como overlay deslizable ── */
  .sidebar {
    position: fixed; left: -250px; top: 58px;
    width: 240px; height: calc(100vh - 58px);
    z-index: 150; transition: left .25s ease;
    box-shadow: none; overflow-y: auto;
  }
  .sidebar.open {
    left: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,.18);
  }
  .sidebar-logout-mobile { display: block; }

  /* ── Main content ── */
  main { padding: 14px; }
  .app-body { overflow: visible; }

  /* ── Login ── */
  .login-card { padding: 32px 22px; width: calc(100% - 32px); margin: 16px; }

  /* ── Page header ── */
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
  .page-title { font-size: 17px; }

  /* ── KPI grid: 2 columnas ── */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
  .kpi-card { padding: 12px 14px; }
  .kpi-value { font-size: 18px; }
  .kpi-label { font-size: 10px; }

  /* ── Tablas ── */
  .table-scroll-body { max-height: none; overflow-x: auto; }
  th { padding: 8px 10px; font-size: 10px; }
  td { padding: 9px 10px; font-size: 12px; }
  .table-search { width: 160px; }
  .table-toolbar { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }

  /* ── Filter bar ── */
  .filter-bar { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }

  /* ── Section cards ── */
  .section-card { padding: 16px; }

  /* ── Modales: pantalla completa desde abajo ── */
  #modal-overlay { align-items: flex-end; padding: 0; }
  .modal, .modal-sm, .modal-lg, .modal-xl {
    width: 100%; max-width: 100%; border-radius: 16px 16px 0 0;
    max-height: 90vh; padding: 22px 18px;
  }
  .modal-grid { grid-template-columns: 1fr; }
  .modal-grid .full { grid-column: 1; }
  .modal-footer { flex-direction: row; }

  /* ── CAMP ── */
  .camp-prog-bar { width: 70px; }
  .camp-num { width: 80px; }

  /* ── Resumen dos columnas ── */
  div[style*="grid-template-columns:1fr 340px"] {
    grid-template-columns: 1fr !important;
  }
  div[style*="grid-template-columns:repeat(3,1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}
