:root {
  --ink: #eef2f8;
  --ink-soft: #b7c0d1;
  --muted: #7c869c;
  --line: #232c3f;
  --bg: #0a0e16;
  --surface: #121a29;
  --surface-2: #182137;
  --input-border: #2a3450;
  --bar-track: rgba(255,255,255,0.08);
  --accent: #2f6fed;
  --accent-glow: #4d8dff;
  --accent-ink: #5b93ff;
  --accent-grad: linear-gradient(135deg, #2f6fed, #1c4fd6);
  --ok: #22c55e;
  --ok-bg: rgba(34,197,94,0.12);
  --warn: #f5a524;
  --warn-bg: rgba(245,165,36,0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239,68,68,0.12);
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 7px;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.35);
  --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body.light-theme {
  --ink: #10151c;
  --ink-soft: #4b5563;
  --muted: #6b7280;
  --line: #e2e5ea;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --input-border: #d7dbe1;
  --bar-track: rgba(16,21,28,0.08);
  --shadow-card: 0 1px 2px rgba(16,21,28,0.05), 0 6px 20px rgba(16,21,28,0.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--ink);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-ink); }

.layout { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */

.sidebar {
  width: 72px;
  background: linear-gradient(180deg, #2f6fed, #1c4fd6);
  border-right: 1px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 0 14px;
  height: 100vh;
  overflow-y: auto;
  overflow-x: visible;
  position: sticky;
  top: 0;
  scrollbar-width: none;
  transition: width 0.15s ease;
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar.expanded { width: 234px; align-items: stretch; }

.sidebar-toggle {
  width: 40px;
  height: 32px;
  margin: 6px auto 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(255,255,255,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.16); color: #fff; }
.sidebar-toggle svg { width: 18px; height: 18px; }
.sidebar.expanded .sidebar-toggle { align-self: flex-end; margin-right: 14px; }

.sidebar .brand {
  width: 38px;
  height: 38px;
  margin-bottom: 16px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(0,0,0,0.35));
}
.sidebar.expanded .brand {
  width: 100%;
  height: 56px;
  padding: 0 18px;
  display: flex;
  align-items: center;
}
.sidebar .brand svg, .sidebar .brand img { width: 100%; height: 100%; display: block; object-fit: contain; }
.sidebar .brand .brand-mask {
  display: block;
  width: 100%;
  height: 100%;
  background-color: #fff;
  -webkit-mask-image: url(/assets/img/logo-mark.png);
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-image: url(/assets/img/logo-mark.png);
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
}
.sidebar .brand .brand-mask-full {
  display: none;
  width: 100%;
  height: 100%;
  background-color: #fff;
  -webkit-mask-image: url(/assets/img/logo.png);
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: left center;
  mask-image: url(/assets/img/logo.png);
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: left center;
}
.sidebar.expanded .brand .brand-mask { display: none; }
.sidebar.expanded .brand .brand-mask-full { display: block; }

.sidebar nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
}

.sidebar .nav-divider {
  width: 28px;
  height: 1px;
  background: rgba(255,255,255,0.2);
  margin: 8px 0;
  flex-shrink: 0;
}

.sidebar nav a {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  color: rgba(255,255,255,0.72);
  text-decoration: none;
  flex-shrink: 0;
}
.sidebar nav a svg { width: 19px; height: 19px; }
.sidebar nav a:hover { background: rgba(255,255,255,0.14); color: #fff; }
.sidebar nav a.active {
  background: #f97316;
  color: #fff;
  box-shadow: 0 0 16px rgba(249,115,22,0.55);
}

.sidebar nav a .tip, .sidebar .user-box a .tip, .sidebar .nav-group-header .tip {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: #0d1424;
  color: #fff;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 7px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  border: 1px solid var(--line);
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 40;
}
.sidebar nav a:hover .tip, .sidebar .user-box a:hover .tip { opacity: 1; transform: translateY(-50%) translateX(0); }

/* Modo expandido: nombres siempre visibles en linea, sin depender del hover */
.sidebar.expanded nav { align-items: stretch; }
.sidebar.expanded nav a {
  width: auto;
  height: 40px;
  justify-content: flex-start;
  padding: 0 15px;
  gap: 12px;
}
.sidebar.expanded .nav-divider { width: auto; margin: 8px 16px; }
.sidebar.expanded a .tip {
  position: static;
  opacity: 1;
  transform: none;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: 0.83rem;
  font-weight: 500;
  white-space: nowrap;
}

.sidebar .user-box {
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.sidebar.expanded .user-box { align-items: stretch; }
.sidebar .user-avatar {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.82rem;
  flex-shrink: 0;
}
.sidebar.expanded .user-avatar { margin-left: 15px; }
.sidebar .user-avatar .dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ok);
  border: 2px solid #1c4fd6;
}
.sidebar .user-box a.logout {
  position: relative;
  width: 40px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.72);
}
.sidebar.expanded .user-box a.logout {
  width: auto;
  height: 40px;
  justify-content: flex-start;
  padding: 0 15px;
  gap: 12px;
}
.sidebar .user-box a.logout:hover { background: rgba(255,255,255,0.16); color: #fff; }
.sidebar .user-box a.logout svg { width: 17px; height: 17px; }

/* ---------- Main ---------- */

.main { flex: 1; padding: 30px 36px 60px; max-width: 1320px; margin: 0 auto; width: 100%; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
}
.topbar h1 { font-size: 1.4rem; font-weight: 700; margin: 0; color: var(--ink); letter-spacing: -0.01em; }
.topbar p.subtitle { margin: 3px 0 0; font-size: 0.85rem; color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 999px;
  border: none;
  background: var(--accent-grad);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 2px 12px rgba(47,111,237,0.45);
  transition: filter 0.12s ease;
}
.btn:hover { filter: brightness(1.12); color: #fff; }
.btn.secondary { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.btn.secondary:hover { background: #1f2a42; }
.btn.danger { background: linear-gradient(135deg, var(--danger), #b91c1c); box-shadow: 0 2px 12px rgba(239,68,68,0.35); }
.btn.small { padding: 5px 12px; font-size: 0.78rem; }

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--line);
  margin-bottom: 22px;
}

.kpis { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 22px; }
.kpi {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--line);
  flex: 1 1 190px;
  min-width: 190px;
}
.kpi .label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.kpi .value { font-size: 1.5rem; font-weight: 800; color: var(--ink); margin-top: 6px; letter-spacing: -0.01em; }
.kpi.ok .value { color: #4ade80; }
.kpi.warn .value { color: #fbbf24; }
.kpi.danger .value { color: #f87171; }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 0.71rem; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; }
tbody tr:hover { background: rgba(255,255,255,0.025); }
tbody tr:last-child td { border-bottom: none; }
td a { color: var(--accent-ink); font-weight: 600; text-decoration: none; }
td a:hover { text-decoration: underline; }

/* status badges: colored dot + text, no fill (matches reference tables) */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.badge::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}
.badge.pendiente, .badge.abierto { color: #fbbf24; }
.badge.pendiente::before, .badge.abierto::before { background: #fbbf24; }
.badge.cobrada, .badge.pagada, .badge.aceptado, .badge.facturado { color: #4ade80; }
.badge.cobrada::before, .badge.pagada::before, .badge.aceptado::before, .badge.facturado::before { background: #4ade80; }
.badge.anulada, .badge.rechazado { color: #f87171; }
.badge.anulada::before, .badge.rechazado::before { background: #f87171; }

/* light-fill pill, for categories/tags */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  background: rgba(47,111,237,0.16);
  color: var(--accent-ink);
}

form.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 20px; }
form.form-grid .full { grid-column: 1 / -1; }
.field label { display:block; font-size: 0.78rem; color: var(--ink-soft); margin-bottom: 5px; font-weight: 600; }
input, select, textarea {
  padding: 9px 11px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  font-size: 0.89rem;
  font-family: var(--font-main);
  background: var(--surface-2);
  color: var(--ink);
}
.field input, .field select, .field textarea { width: 100%; }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47,111,237,0.22);
}
.field textarea { resize: vertical; }

.actions-row { display: flex; gap: 10px; margin-top: 18px; }

.alert { padding: 11px 15px; border-radius: var(--radius-md); margin-bottom: 16px; font-size: 0.87rem; font-weight: 500; }
.alert.success { background: var(--ok-bg); color: #4ade80; border: 1px solid rgba(34,197,94,0.3); }
.alert.error { background: var(--danger-bg); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.alert.warn { background: var(--warn-bg); color: #fbbf24; border: 1px solid rgba(245,165,36,0.3); }

.login-page {
  display:flex; align-items:center; justify-content:center; min-height:100vh;
  background: radial-gradient(circle at 30% 20%, #10192e, #05070c 65%);
}
.login-box {
  background: var(--surface);
  padding: 40px 36px;
  border-radius: var(--radius-lg);
  width: 340px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--line);
}
.login-box h1 { color: var(--ink); font-size: 1.35rem; margin-bottom: 4px; font-weight: 800; letter-spacing: -0.01em; }
.login-box p.tagline { color: var(--muted); font-size: 0.8rem; margin-bottom: 22px; }

.text-muted { color: var(--muted); font-size: 0.82rem; }
.right { text-align: right; }
.center { text-align: center; }
code { background: var(--surface-2); color: var(--accent-ink); padding: 2px 6px; border-radius: 4px; font-size: 0.88em; }
.chart-baseline { stroke: var(--line); }
.chart-dot { fill: var(--bg); stroke: var(--accent-ink); }

@media print {
  .sidebar, .no-print { display: none !important; }
  .main { padding: 0; }
  body { background: #fff; color: #000; }
  .card, .kpi { border: 1px solid #ccc; box-shadow: none; background: #fff; color: #000; }
}

@media (max-width: 760px) {
  .sidebar { width: 56px; }
  .main { padding: 20px 16px 50px; }
  form.form-grid { grid-template-columns: 1fr; }
}

/* ---------- Kanban (Pipeline de Ventas) ---------- */
.oculto { display: none !important; }

.kanban-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 8px;
}
.kanban-col {
  flex: 0 0 260px;
  width: 260px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 340px);
  min-height: 220px;
  transition: box-shadow 0.15s ease, background 0.15s ease;
}
.kanban-col.drop-target {
  box-shadow: 0 0 0 2px var(--accent);
  background: var(--surface-2);
}
.kanban-col-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px 4px;
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.kanban-col-title { font-weight: 700; font-size: 0.86rem; color: var(--ink); }
.kanban-col-count {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.kanban-col-total { padding: 0 14px 10px; font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.kanban-cards {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
}
.kanban-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  cursor: grab;
  touch-action: none; /* imprescindible para que el arrastre funcione en movil/tablet sin pelearse con el scroll de la pagina */
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: 0.35; }
.kanban-card:hover { border-color: var(--accent); }
.kanban-card-title {
  display: block;
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--ink);
  text-decoration: none;
  margin-bottom: 4px;
}
.kanban-card-title:hover { color: var(--accent-ink); }
.kanban-card-producto {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-ink);
  background: rgba(47, 111, 237, 0.16);
  border-radius: 5px;
  padding: 2px 7px;
  margin-bottom: 6px;
}
.kanban-card-concepto {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kanban-card-meta { display: flex; justify-content: space-between; align-items: center; }
.kanban-card-importe { font-size: 0.8rem; font-weight: 700; color: var(--ink); }
.kanban-card-seguimiento {
  margin-top: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}
.kanban-card-seguimiento.vencido { color: var(--danger); }
.kanban-card-vendedor { margin-top: 4px; font-size: 0.72rem; color: var(--muted); }
.kanban-card-fase-form { margin-top: 8px; }
.kanban-card-fase-form select {
  width: 100%;
  padding: 5px 8px;
  font-size: 0.74rem;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--input-border);
  color: var(--muted);
}
.kanban-card-fase-form select:hover { color: var(--ink); border-color: var(--accent); }

@media (max-width: 760px) {
  .kanban-col { flex: 0 0 220px; width: 220px; }
}

/* ---------- Taller: tarjetas grandes de pieza (pensadas para tablet, sin ambigüedad) ---------- */
.taller-piezas { display: flex; flex-direction: column; gap: 12px; }
.taller-pieza {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}
.taller-pieza-curso { border-color: var(--warn); }
.taller-pieza-hecha { border-color: var(--ok); opacity: 0.7; }
.taller-pieza-info { flex: 1; min-width: 0; }
.taller-pieza-nombre { font-size: 1.15rem; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.taller-pieza-hecha .taller-pieza-nombre { text-decoration: line-through; }
.taller-pieza-cantidad { font-size: 0.9rem; color: var(--muted); font-weight: 600; }
.taller-pieza-notas { font-size: 0.85rem; color: var(--ink-soft); margin-top: 6px; }
.taller-pieza-tiempo { font-size: 0.85rem; color: var(--muted); margin-top: 6px; font-weight: 600; }
.taller-pieza-accion { flex-shrink: 0; text-align: center; }
.taller-boton {
  display: block;
  width: 130px;
  padding: 16px 8px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: 0.02em;
  cursor: pointer;
  color: #fff;
  text-align: center;
}
.taller-boton-empezar { background: var(--accent-grad); }
.taller-boton-empezar:hover { filter: brightness(1.1); }
.taller-boton-terminar { background: linear-gradient(135deg, #22c55e, #16a34a); }
.taller-boton-terminar:hover { filter: brightness(1.1); }
.taller-boton-hecho { background: var(--ok-bg); color: var(--ok); cursor: default; }
.taller-reabrir { margin-top: 8px; background: none; border: none; color: var(--muted); font-size: 0.76rem; text-decoration: underline; cursor: pointer; padding: 4px; }
.taller-reabrir:hover { color: var(--ink); }

@media (max-width: 640px) {
  .taller-pieza { flex-direction: column; align-items: stretch; }
  .taller-boton { width: 100%; }
}

/* ---------- Plano incrustado dentro de la tarjeta de pieza del taller ---------- */
.taller-plano {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.taller-plano-svg {
  background: #fff;
  border-radius: 10px;
  padding: 10px;
  max-width: 420px;
  overflow: hidden;
}
.taller-plano-svg svg { width: 100%; height: auto; display: block; }
.taller-plano-datos { margin-top: 8px; font-size: 0.85rem; color: var(--ink-soft); font-weight: 600; }
.taller-plano-notas { margin-top: 4px; font-size: 0.85rem; color: var(--warn); }
.taller-plano-link { display: inline-block; margin-top: 8px; font-size: 0.85rem; font-weight: 700; color: var(--accent-ink); text-decoration: none; }
.taller-plano-link:hover { text-decoration: underline; }

/* ---------- Trazado de chapa (bend allowance) dentro de la tarjeta de pieza ---------- */
.taller-trazado {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
}
.taller-trazado-titulo { font-weight: 700; font-size: 0.86rem; color: var(--accent-ink); margin-bottom: 8px; }
.taller-trazado-svg { background: #fff; border-radius: 8px; padding: 10px; max-width: 420px; overflow: hidden; }
.taller-trazado-svg svg { width: 100%; height: auto; display: block; }
.taller-trazado-dato { font-size: 0.85rem; color: var(--ink-soft); margin-top: 6px; }
.taller-trazado-error { color: #f87171; font-size: 0.86rem; font-weight: 600; border-color: #f87171; }

/* ---------- CRM: hub principal ---------- */
.crm-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.crm-tile {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.crm-tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.crm-tile-icono { font-size: 1.8rem; margin-bottom: 8px; }
.crm-tile-titulo { font-weight: 700; color: var(--ink); font-size: 1rem; }
.crm-tile-dato { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }

.crm-pipeline-resumen {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.crm-fase-card {
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}
.crm-fase-nombre { font-size: 0.78rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.crm-fase-numero { font-size: 1.6rem; font-weight: 800; color: var(--ink); margin: 6px 0 2px; }
.crm-fase-importe { font-size: 0.82rem; color: var(--muted); }

/* ---------- Calendario de Marketing ---------- */
.calendario-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.calendario-cabecera {
  text-align: center;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-bottom: 6px;
}
.calendario-dia {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  min-height: 92px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.calendario-dia-fuera { opacity: 0.35; }
.calendario-dia-hoy { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.calendario-dia-numero { font-size: 0.78rem; font-weight: 700; color: var(--ink-soft); margin-bottom: 2px; }
.calendario-chip {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 760px) {
  .calendario-dia { min-height: 60px; }
  .calendario-chip { display: none; }
  .calendario-dia-numero { font-size: 0.72rem; }
}

/* ---------- Sidebar: grupos plegables (para reducir el ruido visual del menu) ---------- */
.nav-group { width: 100%; display: flex; flex-direction: column; align-items: center; }
.sidebar.expanded .nav-group { align-items: stretch; }

.nav-group-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  color: rgba(255,255,255,0.72);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  flex-shrink: 0;
}
.nav-group-header svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav-group-header:hover { background: rgba(255,255,255,0.14); color: #fff; }
.nav-group-header:hover .tip { opacity: 1; transform: translateY(-50%) translateX(0); }
.nav-group-chevron { display: none; } /* solo tiene sentido verlo con la etiqueta, en modo expandido */

.nav-group-items {
  display: none;
  width: 100%;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.nav-group.nav-group-open .nav-group-items { display: flex; }
.sidebar.expanded .nav-group-items { align-items: stretch; }

/* Modo expandido: cabecera con etiqueta + flecha que gira, hijos con sangria */
.sidebar.expanded .nav-group-header {
  width: auto;
  height: 40px;
  justify-content: flex-start;
  padding: 0 15px;
  gap: 12px;
}
.sidebar.expanded .nav-group-chevron {
  display: block;
  width: 15px;
  height: 15px;
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0.6;
  transition: transform 0.15s ease;
}
.sidebar.expanded .nav-group.nav-group-open .nav-group-chevron { transform: rotate(180deg); }
.sidebar.expanded .nav-group-label {
  position: static; opacity: 1; transform: none; background: none; border: none; padding: 0;
  color: inherit; font-size: 0.83rem; font-weight: 700; white-space: nowrap;
}
.sidebar.expanded .nav-group-items a { padding-left: 27px; }
