/* ===== Identidad: colchonería =====
   Motivo: el "ticking", la tela a rayas de los colchones. Aparece en el menú y en la factura.
   El color principal se cambia desde Configuración (variable --brand). */
:root {
  --brand: #3a5fa8;
  --brand-dark: color-mix(in srgb, var(--brand) 70%, #000);
  --brand-soft: color-mix(in srgb, var(--brand) 11%, #fff);
  --ink: #081330;
  --grad: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 40%, #25b9ff));
  --paper: #eef1f6;
  --line: #dce2ec;
  --muted: #6b7690;
  --radius: 12px;
  --sidebar-w: 250px;
}

body {
  font-family: 'Figtree', system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
}
h1, h2, h3, h4, h5, h6, .brand-name, .stat-val {
  font-family: 'Sora', 'Figtree', sans-serif;
  letter-spacing: -0.01em;
}
h3 { font-weight: 700; font-size: 1.4rem; }

/* ----- Tela a rayas (ticking) ----- */
.ticking {
  height: 5px;
  background: var(--grad);
}

/* ----- Menú lateral ----- */
.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--ink);
  color: #c4cde0;
  display: flex; flex-direction: column;
  z-index: 1040;
  transition: transform .2s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: .8rem;
  padding: 1.25rem 1.25rem 1.1rem;
  color: #fff; text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-mark {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px; font-size: 1.2rem;
  background: var(--grad); color: #021028;
}
.brand-logo { width: 42px; height: 42px; object-fit: contain; border-radius: 10px; background: #fff; padding: 3px; flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-weight: 700; font-size: 1.05rem; line-height: 1.2; overflow-wrap: anywhere; }
.brand-sub { font-size: .8rem; color: #98a4bf; }

.sidebar-nav { padding: .75rem .75rem 1.5rem; overflow-y: auto; }
.nav-group { font-size: .8rem; color: #8592af; padding: 1rem .75rem .4rem; }
.nav-item-link {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .75rem; margin-bottom: 2px;
  border-radius: 9px; color: #c4cde0; text-decoration: none; font-weight: 500;
}
.nav-item-link i { font-size: 1.1rem; }
.nav-item-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item-link.active { background: var(--grad); color: #021028; font-weight: 600; }

/* ----- Contenido ----- */
.content { margin-left: var(--sidebar-w); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 1020;
  display: flex; align-items: center; gap: 1rem;
  padding: .85rem 1.75rem;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { font-size: 1.15rem; font-weight: 700; margin: 0; }
.topbar-date { margin-left: auto; color: var(--muted); font-size: .9rem; }
.btn-menu { display: none; border: 0; background: none; font-size: 1.7rem; line-height: 1; color: var(--ink); padding: 0; }
.page { padding: 1.75rem; max-width: 1280px; }
.sidebar-overlay { display: none; }

/* ----- Tarjetas, tablas, formularios ----- */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; }
.card-header {
  background: #fff; border-bottom: 1px solid var(--line);
  font-family: 'Sora', sans-serif; font-weight: 700;
  border-radius: var(--radius) var(--radius) 0 0 !important;
}
.table { --bs-table-bg: transparent; }
.table > :not(caption) > * > * { padding: .7rem .9rem; }
.table thead th { font-weight: 600; color: var(--muted); background: #f7f9fc; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table-hover > tbody > tr:hover > * { background: var(--brand-soft); }

.form-control, .form-select { border-color: #cfd7e4; border-radius: 9px; }
.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--brand) 22%, transparent);
}
.form-label { font-weight: 500; font-size: .92rem; margin-bottom: .25rem; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }

.btn { border-radius: 999px; font-weight: 600; }
.btn-primary {
  --bs-btn-color: #021028; --bs-btn-hover-color: #021028; --bs-btn-active-color: #021028; --bs-btn-disabled-color: #021028;
  --bs-btn-bg: transparent; --bs-btn-hover-bg: transparent; --bs-btn-active-bg: transparent; --bs-btn-disabled-bg: transparent;
  --bs-btn-border-color: transparent; --bs-btn-hover-border-color: transparent; --bs-btn-active-border-color: transparent;
  background-image: var(--grad);
}
.btn-primary:hover, .btn-primary:focus { filter: brightness(1.08); }
.btn-outline-primary {
  --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: var(--brand);
}
.nav-tabs .nav-link { color: var(--muted); font-weight: 500; border: 0; border-bottom: 2px solid transparent; }
.nav-tabs .nav-link.active { color: var(--brand); border-bottom-color: var(--brand); background: none; }
.nav-tabs { border-bottom: 1px solid var(--line); }

/* ----- Indicadores del panel ----- */
.stat { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem; }
.stat-ico {
  width: 46px; height: 46px; flex: none; display: grid; place-items: center;
  border-radius: 12px; font-size: 1.3rem;
  background: var(--brand-soft); color: var(--brand);
}
.stat-val { font-size: 1.55rem; font-weight: 700; line-height: 1.1; }
.stat-lbl { color: var(--muted); font-size: .9rem; }
.rank-row { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; border-bottom: 1px solid var(--line); }
.rank-row:last-child { border-bottom: 0; }
.rank-bar { height: 6px; border-radius: 3px; background: var(--brand-soft); flex: 1; overflow: hidden; }
.rank-bar > span { display: block; height: 100%; background: var(--brand); }

.total-box { font-family: 'Sora', sans-serif; font-size: 1.6rem; font-weight: 700; }

/* ----- Factura ----- */
.factura-print {
  background: #fff; max-width: 820px; margin: auto;
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.factura-print .factura-body { padding: 2rem 2.25rem; }
.factura-logo { max-height: 64px; max-width: 160px; object-fit: contain; }

/* ----- Móvil ----- */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .sidebar-overlay.show { display: block; position: fixed; inset: 0; background: rgba(10,16,32,.5); z-index: 1030; }
  .content { margin-left: 0; }
  .btn-menu { display: block; }
  .topbar { padding: .75rem 1rem; }
  .topbar-date { display: none; }
  .page { padding: 1rem; }
}

/* ----- Impresión ----- */
@media print {
  .sidebar, .topbar, .no-print, .sidebar-overlay { display: none !important; }
  .content { margin-left: 0 !important; }
  body { background: #fff; }
  .page { padding: 0; max-width: none; }
  .factura-print { border: 0; border-radius: 0; }
  .ticking { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ----- Pie del menú (usuario y salida) ----- */
.sidebar { overflow: hidden; }
.sidebar-nav { flex: 1; }
.sidebar-foot { padding: .75rem .75rem 1rem; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-foot .small { padding: 0 .75rem; color: #c4cde0; }

/* ----- Marca sola en el menú ----- */
.brand-marca { width: 44px; height: 44px; object-fit: contain; flex: none; }
.sidebar-nav { overflow-y: auto; }
