/* Paleta y tokens de diseño: fuente única en shared/static/rols-tokens.css
   (servido en /shared/rols-tokens.css). No redefinir aquí. */
@import url("/shared/rols-tokens.css");

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-page);
  color: #2a2a2a;
}
.sidebar { background: var(--bg-sidebar); color: var(--text-sidebar); }
.rols-logo {
  /* Logo oficial: PNG negro sobre transparente. brightness(0) lo deja
     totalmente negro y invert(1) lo pasa a blanco, asi se ve blanco
     sobre el fondo oliva del sidebar. */
  width: 90px; height: auto; display: block;
  filter: brightness(0) invert(1);
}
.sidebar a {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.55rem 0.85rem; border-radius: 0.5rem;
  font-size: 0.875rem; color: var(--text-sidebar);
  transition: background 0.15s;
}
.sidebar a:hover { background: var(--bg-sidebar-hover); }
.sidebar a.active { background: var(--bg-sidebar-active); color: var(--text-sidebar-active); font-weight: 500; }
.sidebar a .check {
  width: 16px; height: 16px; border: 1.5px solid #888879; border-radius: 4px;
  display: inline-block; flex-shrink: 0;
}
.sidebar a.active .check { background: var(--accent); border-color: var(--accent); }
.btn-accent {
  background: var(--accent); color: #fff; border-radius: 999px;
  padding: 0.55rem 1.1rem; font-size: 0.875rem; font-weight: 500;
  transition: background 0.15s;
}
.btn-accent:hover { background: var(--accent-hover); }
.btn-outline {
  background: transparent; border: 1px solid #d4cfc0; color: var(--text-sidebar);
  border-radius: 999px; padding: 0.55rem 1.1rem; font-size: 0.875rem;
  transition: background 0.15s;
}
.btn-outline:hover { background: var(--bg-sidebar-hover); }
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 18px; }
.input-line {
  width: 100%; padding: 0.7rem 0.95rem; border-radius: 14px;
  border: 1px solid var(--border); background: #fff; font-size: 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input-line:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(179,153,98,0.15); }
.step-badge {
  width: 28px; height: 28px; border-radius: 999px;
  background: #EFE2CD; color: #B89368;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 600; flex-shrink: 0;
}
.pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.45rem 0.95rem; border-radius: 999px;
  font-size: 0.85rem; font-weight: 500; cursor: pointer;
  border: 1px solid var(--border); background: #fff;
  transition: all 0.15s;
}
.pill .swatch {
  width: 14px; height: 14px; border-radius: 3px;
  background: linear-gradient(135deg,#D5B38C 30%, #fff 30% 35%, #D5B38C 35%);
}
.pill.active { background: var(--accent-soft); border-color: var(--accent); color: #B89368; }
.badge-status {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.25rem 0.65rem; border-radius: 999px;
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge-correcto { background: #d6efd6; color: #1f5d2c; }
.badge-saldo { background: #e8dfc9; color: #6b5b2b; }
.badge-aprestado { background: #ddeaf3; color: #294f6b; }
.badge-anotaciones { background: #f3e5d0; color: #6b4a25; }
.badge-agotado { background: #f3d4d4; color: #6f1f1f; }
.badge-lanzada { background: #d6e4f3; color: #2c4a6b; }
.badge-planif { background: #ede4f3; color: #4a2c6b; }
.badge-correcto .dot, .badge-saldo .dot, .badge-aprestado .dot,
.badge-anotaciones .dot, .badge-agotado .dot,
.badge-lanzada .dot, .badge-planif .dot {
  width: 6px; height: 6px; border-radius: 999px; background: currentColor;
}
.obs-toggle { cursor: pointer; user-select: none; }
.obs-toggle:hover { filter: brightness(0.92); }
.obs-row td {
  padding: 0 1rem 0.75rem !important;
  border-bottom: 1px solid #F2EDE8;
}
.obs-content {
  background: #F2EDE8; border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: 8px;
  padding: 0.75rem 1rem; font-size: 0.85rem; color: #B89368; line-height: 1.5;
}
.obs-content > div + div { margin-top: 0.45rem; }
.obs-content strong { color: #4D4D4D; }

/* ---- Badge "Reservas" en la celda de longitud no comprometida ---- */
.libre-cell { display: inline-flex; align-items: center; gap: 0.55rem; }
.res-badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: #F2EDE8; border: 1px solid var(--border);
  color: #B89368; font-size: 0.7rem; font-weight: 500;
  padding: 0.18rem 0.55rem; border-radius: 999px;
  cursor: pointer; transition: background 0.12s, color 0.12s, border-color 0.12s;
  font-family: inherit; line-height: 1;
}
.res-badge:hover { background: var(--accent-soft); color: var(--accent-hover); border-color: var(--accent); }
.res-badge svg { stroke: currentColor; }

/* ---- Fila expandida con el detalle de reservas ---- */
.res-row td {
  padding: 0 1rem 0.75rem !important;
  border-bottom: 1px solid #F2EDE8;
  background: #FAF8F6;
}
.res-content {
  background: #fff; border: 1px solid var(--border);
  border-left: 3px solid #B89368; border-radius: 8px;
  padding: 0.85rem 1rem; font-size: 0.82rem; color: #4D4D4D;
}
.res-grid { display: flex; flex-direction: column; gap: 0.9rem; }
.res-section-title {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: #7A7A7A;
  margin-bottom: 0.4rem;
}
.res-section-firme  { color: #294f6b; }
.res-section-manual { color: #6b4a25; }
.res-count {
  display: inline-block; min-width: 1.4em; text-align: center;
  background: var(--accent-soft); color: var(--accent-hover);
  font-size: 0.65rem; padding: 0.05rem 0.45rem; border-radius: 999px;
  letter-spacing: 0;
}
.res-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.res-table thead th {
  text-align: left; font-weight: 600; color: #9a9a9a;
  font-size: 0.65rem; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 0.3rem 0.55rem; border-bottom: 1px solid #F2EDE8;
}
.res-table tbody td {
  padding: 0.35rem 0.55rem;
  border-bottom: 1px solid #F8F5F1;
}
.res-table tbody tr:last-child td { border-bottom: none; }
.res-table .num { font-variant-numeric: tabular-nums; font-weight: 600; color: #2a2a2a; }
.res-table .user-cell { color: #7A7A7A; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.72rem; }
.res-table .cli-code { font-size: 0.7rem; color: #9a9a9a; }
.res-table .obs-cell { color: #6a6a6a; font-style: italic; max-width: 280px; }
/* Ocultar columna de fecha fin fabricacion cuando solo hay stock */
table.no-fab .col-fab { display: none; }
/* Dropdown custom de referencia (reemplaza al datalist nativo) */
.ref-combo { position: relative; }
.ref-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 14px 38px -10px rgba(77,77,77,0.20);
  z-index: 50; max-height: 380px; overflow: hidden;
  display: flex; flex-direction: column;
  animation: refDropdownIn 0.12s ease-out;
}
@keyframes refDropdownIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.ref-dropdown-header {
  padding: 0.55rem 1rem; font-size: 0.7rem;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: #7A7A7A; background: #FAF8F6;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ref-dropdown-list { overflow-y: auto; flex: 1; padding: 0.25rem 0; }
.ref-group + .ref-group { border-top: 1px solid #F2EDE8; }
.ref-group-header {
  padding: 0.55rem 1rem 0.45rem; font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: #B89368;
  /* z-index: 2 garantiza que el header sticky se quede por encima de las
   * .ref-option que scrollean por detras (el thumbnail tiene position:
   * relative, lo que sin z-index lo deja flotando sobre el header). */
  position: sticky; top: 0; z-index: 2;
  background: #fff;
  box-shadow: 0 1px 0 #F2EDE8;
}
.ref-option {
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background 0.08s;
  display: flex; align-items: center; gap: 0.65rem;
}
.ref-option:hover, .ref-option.active {
  background: var(--accent-soft);
}
/* Thumbnail del color (mismas reglas que la calculadora para que la UX
 * sea identica). Si la imagen no existe, el wrap usa el patron diagonal
 * crema para no romper el layout. */
.ref-option-thumb-wrap {
  width: 36px; height: 36px; border-radius: 6px;
  background: #f5efe7;
  box-shadow: 0 0 0 1px rgba(77,77,77,0.08);
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}
.ref-option-thumb-wrap.ref-option-thumb-empty {
  background: repeating-linear-gradient(135deg, #f5efe7, #f5efe7 4px, #ece4d6 4px, #ece4d6 8px);
}
.ref-option-thumb {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.ref-option-text { flex-grow: 1; min-width: 0; }
.ref-option-label {
  font-size: 0.875rem; font-weight: 500; color: #2a2a2a; line-height: 1.25;
}
.ref-option-full {
  font-size: 0.72rem; color: #7A7A7A; margin-top: 0.1rem; line-height: 1.2;
}
.ref-option:hover .ref-option-label,
.ref-option.active .ref-option-label { color: #B89368; }
.ref-option:hover .ref-option-full,
.ref-option.active .ref-option-full { color: #4D4D4D; }
.ref-option mark {
  background: rgba(213,179,140,0.35); color: inherit;
  border-radius: 2px; padding: 0 1px;
}
.ref-empty {
  padding: 1.75rem 1rem; text-align: center; color: #7A7A7A;
  font-size: 0.875rem;
}
.row-highlight { background: var(--accent-soft); }
.row-highlight td:first-child { border-left: 3px solid var(--accent); padding-left: calc(1rem - 3px); }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 0.7rem; font-weight: 600;
  color: #7A7A7A; padding: 0.85rem 1rem; letter-spacing: 0.05em; text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 0.95rem 1rem; font-size: 0.875rem; color: #2a2a2a;
  border-bottom: 1px solid #F2EDE8;
}
tbody tr:last-child td { border-bottom: none; }
.link-action { color: #B89368; font-size: 0.8rem; text-decoration: underline; text-underline-offset: 3px; }
.link-action:hover { color: var(--accent); }
.breadcrumb { font-size: 0.85rem; color: #7A7A7A; }
.breadcrumb a { color: #7A7A7A; }
.breadcrumb a:hover { color: var(--accent); }
.sync-pill {
  display: inline-flex; align-items: center; gap: 0.45rem;
  background: #fff; border: 1px solid var(--border);
  padding: 0.4rem 0.85rem; border-radius: 999px; font-size: 0.78rem; color: #7A7A7A;
}
.sync-pill .dot { width: 8px; height: 8px; background: #5cba78; border-radius: 999px; }
.spinner { border: 2px solid #eee; border-top: 2px solid var(--accent); border-radius: 50%; width: 14px; height: 14px; animation: spin 0.6s linear infinite; }

/* Versión "boton" del sync-pill: clickable, con hover, y estados visuales
 * para sincronizando / ok / error. Reutiliza el resto del estilo de .sync-pill. */
.sync-btn {
  cursor: pointer; transition: background 0.12s, border-color 0.12s, color 0.12s;
  font-family: inherit;
}
.sync-btn:hover { background: #FAF8F6; border-color: #D5B38C; color: #4D4D4D; }
.sync-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sync-btn .sync-sep { color: #C9C2BA; }
.sync-btn .sync-icon { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; }
.sync-btn .sync-icon .spinner { width: 12px; height: 12px; }

/* Estado: sincronizando */
.sync-btn.is-loading { cursor: wait; color: #4D4D4D; }
.sync-btn.is-loading:hover { background: #fff; }

/* Estado: ok (verde discreto, vuelve a normal tras unos segundos) */
.sync-btn.is-ok { background: #E8F3E8; border-color: #b8d8b8; color: #1f5d2c; }
.sync-btn.is-ok .dot { background: #1f5d2c; }

/* Estado: error (rojo suave) */
.sync-btn.is-error { background: #F8E0E0; border-color: #d8b8b8; color: #6f1f1f; }
.sync-btn.is-error .dot { background: #6f1f1f; }
.sync-btn:disabled { cursor: not-allowed; opacity: 0.6; }
@keyframes spin { to { transform: rotate(360deg); } }
.ia-avatar {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 999px;
  background: #EFE2CD; color: #B89368; display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em;
}
.ia-bubble {
  background: #fff; border: 1px solid var(--border); border-radius: 18px;
  padding: 1.1rem 1.25rem; font-size: 0.9rem; color: #2a2a2a; line-height: 1.5;
}
.ia-bubble strong { color: #4D4D4D; }
.user-avatar {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 999px;
  background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em;
}
.user-bubble {
  background: var(--accent-soft); border: 1px solid #E2C9A9; border-radius: 18px;
  padding: 1.1rem 1.25rem; font-size: 0.9rem; color: #4D4D4D; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
}
#search-context {
  position: sticky; top: 1rem; z-index: 5;
}
.search-pill {
  display: inline-flex; align-items: center; gap: 0.65rem;
  background: var(--accent); border: none;
  padding: 0.7rem 1.15rem; border-radius: 14px; font-size: 0.9rem;
  box-shadow: 0 6px 20px -8px rgba(77, 77, 77, 0.35);
  max-width: 100%;
}
.search-pill .icon { color: rgba(255,255,255,0.9); flex-shrink: 0; }
.search-pill .label {
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: rgba(255,255,255,0.78); font-weight: 600; flex-shrink: 0;
}
.search-pill .value {
  color: #fff; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.empty-state { text-align: center; color: #7A7A7A; padding: 3rem 1rem; font-size: 0.9rem; }
/* Boton de microfono (dictado por voz) */
.mic-btn {
  position: absolute; right: 0.45rem; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; padding: 0;
  border: none; background: transparent; color: #7A7A7A;
  border-radius: 999px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.mic-btn:hover { background: var(--accent-soft); color: var(--accent); }
.mic-btn.listening {
  color: #fff; background: #C0392B;
  animation: micPulse 1.4s ease-in-out infinite;
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192,57,43,0.5); }
  50%      { box-shadow: 0 0 0 8px rgba(192,57,43,0); }
}
.mic-btn.unsupported { display: none; }
/* Selector de idioma */
.lang-block {
  padding: 0 0.5rem; margin-bottom: 0.75rem;
}
.lang-block .lang-label {
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: rgba(214,212,200,0.55); font-weight: 600;
  margin-bottom: 0.4rem; display: block;
}
.lang-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.3rem; }
.lang-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.35rem;
  padding: 0.38rem 0.3rem;
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em;
  border: 1px solid rgba(214,212,200,0.18);
  background: transparent; color: var(--text-sidebar);
  border-radius: 0.45rem; cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-align: center;
}
/* Banderas via flag-icons: tamano consistente independiente del SO */
.lang-btn .fi {
  width: 1.15rem; height: 0.85rem; border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
  flex-shrink: 0;
}
.lang-btn .code { line-height: 1; }
.lang-btn:hover { background: var(--bg-sidebar-hover); color: var(--text-sidebar-active); }
.lang-btn.active {
  background: var(--accent); border-color: var(--accent); color: #fff;
}

/* (Estilos .chatbot-* ELIMINADOS: el widget chatbot inline se reemplazo
 *  por el widget compartido shared/static/chatbot/. Sus estilos viven
 *  ahora en chatbot.css, prefijados con .rols-chatbot- para no chocar
 *  con clases de la app que lo monta.) */

/* ----- Segmented control de unidad (cm / m) — portado de la calc ----- */
.unit-switch {
  display: inline-flex; background: var(--soft-bg, #F2EDE8);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 2px;
}
.unit-btn {
  padding: 0.25rem 0.7rem; font-size: 0.72rem; font-weight: 600;
  color: #7A7A7A; background: transparent;
  border-radius: 999px; cursor: pointer;
  transition: all 0.12s;
  letter-spacing: 0.02em;
  font-family: inherit; border: none;
}
.unit-btn:hover { color: var(--accent-hover); }
.unit-btn.active {
  background: var(--accent); color: #fff;
  box-shadow: 0 1px 3px rgba(213,179,140,0.4);
}
