/* Lib Service: complementos mínimos sobre blueorange.css (la hoja de instance_service,
   copiada sin cambios salvo la ruta de las fuentes). Solo lo que esa hoja no trae. */

/* Alta compacta arriba de la lista: una línea en escritorio, apilada en móvil. */
.lib-addbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; margin: 0; }
.lib-addbar label { display: flex; flex-direction: column; gap: 5px; font-size: .8rem; font-weight: 600; color: var(--bo-muted); flex: 1 1 180px; min-width: 0; }
.lib-addbar input, .lib-addbar select { padding: 10px 14px; border: 1px solid var(--bo-border); border-radius: 10px; font-family: inherit; font-size: .92rem; background-color: #fff; color: var(--bo-ink); width: 100%; }
.lib-addbar input:focus, .lib-addbar select:focus, .bo-toolbar input:focus, .bo-toolbar select:focus, .bo-input-sm:focus { outline: none; border-color: var(--bo-purple); box-shadow: 0 0 0 3px rgba(123,47,138,.12); }
.lib-addbar select, .bo-toolbar select, .bo-input-sm-select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%237B2F8A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; background-size: 12px 8px; }
.lib-addbar input[type="file"] { padding: 7px 10px; color: var(--bo-muted); font-size: .85rem; }
.lib-addbar .bo-btn { flex: 0 0 auto; height: 42px; }
.lib-addbar .lib-grow { flex: 2 1 220px; }
.lib-addbar h2 { flex: 0 0 100%; margin: 0 0 -2px; font-size: 1rem; }

.bo-toolbar select { max-width: 100%; }
.bo-toolbar .bo-btn { padding: 10px 16px; }
.lib-count { margin: -6px 0 14px; display: flex; gap: 10px; align-items: center; }

/* Acciones de fila: misma altura, una sola línea, alineadas a la derecha. */
.lib-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: nowrap; }
.lib-actions form { margin: 0; display: flex; }
.lib-actions .bo-btn { height: 32px; padding: 0 12px; font-size: .78rem; }
.bo-table td.lib-actions-cell { width: 1%; }
.lib-chan { display: flex; align-items: center; gap: 8px; }
.lib-chan form { margin: 0; display: flex; align-items: center; gap: 8px; }
.lib-chan select { height: 32px; padding: 0 30px 0 10px; border: 1px solid var(--bo-border); border-radius: 8px; font-family: inherit; font-size: .8rem; background-color: #fff; color: var(--bo-ink); appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%237B2F8A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 10px 7px; }
.bo-table .lib-version-select select { width: 24rem; min-width: 24rem; max-width: 100%; }
.lib-warn { color: #8a4a12; font-weight: 600; }
.bo-table td.lib-wrap, .bo-table th.lib-wrap { white-space: normal; }
.bo-table .bo-muted { font-size: .82rem; }
.bo-table code { font-family: var(--bo-mono); font-size: .85em; }
.bo-table td.lib-radio { width: 1%; }
.bo-table input[type="radio"] { accent-color: var(--bo-purple); width: 16px; height: 16px; }
.bo-table .bo-input-sm { width: 9em; }

.bo-alert--warn { background: #fff3e0; color: #8a4a12; border: 1px solid #e0b676; }
.bo-alert strong { font-weight: 700; }
.bo-alert code, .bo-muted code, .bo-card p code { font-family: var(--bo-mono); font-size: .88em; background: rgba(123,47,138,.07); color: var(--bo-purple); padding: 1px 5px; border-radius: 5px; }
.bo-alert--success { margin-bottom: 18px; }

/* Menú de usuario: el "Salir" es un POST (CSRF), pero se ve como un ítem del menú. */
.bo-dropdown__menu form { margin: 0; }
.bo-dropdown__menu button { width: 100%; text-align: left; background: none; border: 0; cursor: pointer; font-family: inherit; color: var(--bo-ink); padding: 10px 12px; border-radius: 8px; font-size: .92rem; font-weight: 500; }
.bo-dropdown__menu button:hover { background: rgba(123,47,138,.08); color: var(--bo-purple); }

/* Configuración para Odoo (token una sola vez). */
.lib-cfg { display: grid; gap: 14px; margin: 14px 0; }
.lib-cfg label { display: flex; flex-direction: column; gap: 6px; font-size: .88rem; font-weight: 600; }
.lib-token { display: flex; gap: 8px; }
.lib-token input { flex: 1; min-width: 0; padding: 10px 14px; border: 1px solid var(--bo-border); border-radius: 10px; font-family: var(--bo-mono); font-size: .85rem; background: #fff; color: var(--bo-ink); }
.lib-token .bo-btn { flex: 0 0 auto; }

.lib-confirm { max-width: 680px; margin: 0 auto; }
.lib-confirm .bo-alert { margin-bottom: 16px; }
.lib-back { display: inline-block; margin-bottom: 14px; }
.lib-errcode { font-size: 4rem; font-weight: 700; margin: 0; color: var(--bo-coral); line-height: 1; }
.bo-card h2 + .bo-dl, .bo-card .bo-dl + p { margin-top: 12px; }
.bo-form .lib-optrow { display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end; }

@media (max-width: 760px) {
  .lib-addbar .bo-btn, .bo-toolbar .bo-btn { width: 100%; }
  .bo-pager { flex-wrap: wrap; justify-content: center; }
  .bo-pager__info { order: -1; width: 100%; text-align: center; }
  .bo-nav .bo-dropdown__menu { margin-left: 0; }
}
.bo-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Listas densas: tarjeta y celdas más compactas para que la tabla entre en 1280 px sin scroll. */
.bo-card#bo-list { padding: 8px 14px 14px; }
.bo-card#bo-list .bo-table { margin-top: 0; }
.bo-table th, .bo-table td { padding: 10px 10px; }
.bo-table td { vertical-align: middle; }
.bo-table .lib-codes { line-height: 1.5; }
.bo-toolbar select { padding: 10px 32px 10px 12px; max-width: 210px; }
.bo-toolbar input { flex: 1 1 220px; }
/* Un solo ancho para todas las secciones, cabecera incluida: la tabla de instancias es la más
   ancha y las demás pantallas se alinean con ella en vez de tener cada una el suyo. */
.bo-header__inner, .bo-main { max-width: 1320px; }
/* Selectores dentro de una tabla: mismo ancho en todas las filas (si no, cada uno toma el de sus opciones). */
.bo-table select { width: 8.5rem; min-width: 8.5rem; max-width: 8.5rem; }
.bo-main { padding-left: 24px; padding-right: 24px; }
.bo-table { font-size: .86rem; }
.bo-table th, .bo-table td { padding: 9px 8px; }
.bo-table thead th { font-size: .74rem; }
.bo-table .lib-codes code { font-size: .78rem; }
.bo-toolbar input, .bo-toolbar select { font-size: .85rem; padding-top: 9px; padding-bottom: 9px; }
.bo-toolbar select { max-width: 190px; padding-right: 30px; background-position: right 11px center; }
.bo-toolbar input { min-width: 160px; }
.bo-toolbar .bo-btn { padding: 9px 16px; font-size: .85rem; line-height: 1.2; }
.lib-addbar input[type="file"]::file-selector-button { margin-right: 10px; padding: 6px 12px; border: 1px solid var(--bo-purple); border-radius: 8px; background: rgba(123,47,138,.06); color: var(--bo-purple); font-family: inherit; font-weight: 600; font-size: .8rem; cursor: pointer; }
@media (max-width: 760px) {
  .bo-user-trigger:not(:has(.bo-avatar)) { width: auto; height: 38px; padding: 0 14px; border-radius: 999px; gap: 8px; }
  .bo-user-trigger__email { display: inline; font-size: .9rem; }
}

/* Roles: leyenda de lo que el rol no puede y controles deshabilitados. */
.lib-rolenote { margin: 12px 0 0; font-size: .85rem; color: #8a4a12; font-weight: 600; }
.bo-btn:disabled, .bo-btn[disabled], .lib-addbar input:disabled, .lib-addbar select:disabled,
.lib-chan select:disabled, .bo-input-sm:disabled { opacity: .5; cursor: not-allowed; }
.bo-btn:disabled:hover { background: inherit; box-shadow: none; }
.lib-session-note { margin: 6px 4px 10px; font-size: .88rem; color: var(--bo-muted); }

/* Acceso de emergencia: colapsado bajo el botón de Google. */
.lib-emergency { margin-top: 22px; border-top: 1px solid var(--bo-border); padding-top: 14px; }
.lib-emergency summary { cursor: pointer; font-size: .88rem; font-weight: 600; color: var(--bo-muted); }
.lib-emergency summary:hover { color: var(--bo-purple); }
.lib-emergency .bo-form { margin-top: 14px; }

/* Mi cuenta: qué permite cada rol. */
.lib-perms { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.lib-perms li { padding-left: 26px; position: relative; font-size: .92rem; color: var(--bo-muted); }
.lib-perms li::before { content: "—"; position: absolute; left: 4px; color: var(--bo-muted); }
.lib-perms li.is-on { color: var(--bo-ink); }
.lib-perms li.is-on::before { content: "✓"; color: #1d7a45; font-weight: 700; }
.bo-nav .bo-dropdown__menu .bo-muted { word-break: break-all; }
.bo-user-trigger { border-radius: 50%; }

/* repositorios y keys */
.lib-pre { margin: 10px 0; padding: 12px 14px; border: 1px solid var(--bo-border); border-radius: 10px; background: #faf9fc; font-family: var(--bo-mono); font-size: .8rem; line-height: 1.5; white-space: pre-wrap; word-break: break-all; color: var(--bo-ink); }
.lib-steps { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; font-size: .9rem; }
.lib-urlform { display: flex; gap: 8px; align-items: center; margin: 0; }
.lib-urlform input { flex: 1; min-width: 14rem; height: 32px; padding: 0 10px; border: 1px solid var(--bo-border); border-radius: 8px; font-family: var(--bo-mono); font-size: .78rem; background: #fff; color: var(--bo-ink); }
.lib-err { color: #b3243b; font-size: .82rem; }
.lib-meta { margin: 6px 0 0; font-size: .85rem; color: var(--bo-muted); }

/* Librerías por cliente/instancia: badges en una línea y botones sin partir. */
.lib-badges { white-space: normal; }
.lib-badges .bo-badge { margin: 2px 4px 2px 0; white-space: nowrap; }
.bo-table td .bo-badge { white-space: nowrap; }
.lib-actions .bo-btn { white-space: nowrap; }
.bo-hero h1 code { font-family: var(--bo-mono); font-size: .8em; }
.bo-badge.lib-state::before { display: none; }

/* Pantalla "Login con Google" */
.bo-alert--warn { background: #fff3e0; color: #8a4a12; border: 1px solid #f3d3a6; }
.lib-errors { margin: 8px 0 0; padding-left: 20px; }
.lib-settings small { display: block; margin-top: 2px; font-size: .8rem; font-weight: 400; color: var(--bo-muted); }
.lib-settings .lib-switch { flex-direction: row; align-items: flex-start; gap: 10px; }
.lib-settings .lib-switch input { width: auto; margin-top: 4px; flex: 0 0 auto; }
.lib-source { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: .7rem; font-weight: 600; background: #eceaf0; color: #57555f; vertical-align: middle; }
.lib-source--db { background: #e9f7ee; color: #1d7a45; }
.lib-source--env { background: #e6eefb; color: #2f4b8a; }
.lib-readonly { margin-top: 18px; }
.lib-probe { margin: 16px 0 0; }
.lib-probe__list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.lib-probe__icon { display: inline-block; width: 1.2em; font-weight: 700; }
.lib-probe__list .is-off { color: #8a4a12; }
.lib-settings label > .lib-source { align-self: flex-start; margin-left: 0; }
.lib-settings textarea { min-height: 64px; }

/* Sync forzado general: barra de acción bajo los filtros, progreso y tabla con scroll contenido. */
.lib-bulkbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; }
.lib-bulkbar .bo-btn { white-space: nowrap; }
.lib-bulkbar a.bo-link { font-size: .88rem; white-space: nowrap; }
.lib-progress { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; flex-wrap: wrap; }
.lib-progress progress { flex: 1 1 260px; max-width: 560px; height: 14px; accent-color: var(--bo-purple); }
.lib-counters { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.lib-counters .bo-badge, .lib-scroll .bo-badge { white-space: nowrap; }
.lib-scroll { max-height: 560px; overflow: auto; }
.lib-scroll thead th { position: sticky; top: 0; background: #fff; z-index: 1; }
.lib-reasons { margin: 6px 0 0; padding-left: 18px; font-weight: 400; }
.lib-confirm .bo-dl + .bo-alert, .lib-confirm .bo-btn-row { margin-top: 18px; }
.lib-confirm .bo-btn-row { margin-bottom: 0; }

/* Pendientes de alta: contador del menú, avisos y detalle de la lista. */
.bo-nav__count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: var(--bo-coral); color: #fff; font-size: .72rem; font-weight: 700; line-height: 1; text-shadow: none; vertical-align: 1px; }
.lib-pendingbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 18px; }
.lib-pendingbar .bo-btn { white-space: nowrap; }
.bo-table td.lib-nowrap, .bo-table th.lib-nowrap { white-space: nowrap; }
.lib-pending-who { display: grid; gap: 2px; }
.bo-table td.lib-state-cell { min-width: 8rem; max-width: 15rem; }
.lib-pending-who .bo-muted, .lib-mismatch { white-space: nowrap; }
.lib-pending-who strong { font-weight: 700; }
.lib-pending-who .bo-muted { font-size: .8rem; }
.lib-mismatch { display: block; margin-top: 4px; color: #b3243b; font-size: .8rem; font-weight: 600; }
.lib-approve { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.lib-approve .bo-card { margin: 0; }
.lib-approve label { display: flex; flex-direction: column; gap: 5px; font-size: .8rem; font-weight: 600; color: var(--bo-muted); margin-bottom: 14px; }
.lib-approve input, .lib-approve select { padding: 10px 14px; border: 1px solid var(--bo-border); border-radius: 10px; font-family: inherit; font-size: .92rem; background-color: #fff; color: var(--bo-ink); width: 100%; }
.lib-approve select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%237B2F8A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; background-size: 12px 8px; }
.lib-approve input:focus, .lib-approve select:focus { outline: none; border-color: var(--bo-purple); box-shadow: 0 0 0 3px rgba(123,47,138,.12); }
.lib-approve .bo-dl code { overflow-wrap: anywhere; }
@media (max-width: 900px) { .lib-approve { grid-template-columns: 1fr; } }
.lib-known { font-size: .8rem; font-weight: 600; white-space: nowrap; }
.lib-bulkform { margin: 0 0 14px; align-items: center; }
.lib-bulkform .lib-rolenote { margin: 0; }

/* Sincronización: la URL de callback se edita en el mismo lugar, con un lápiz. El valor y el editor se turnan en la misma celda. */
.lib-urlview { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-height: 32px; }
.lib-urlview code { overflow-wrap: anywhere; }
.lib-pencil { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--bo-purple); cursor: pointer; }
.lib-pencil:hover { background: rgba(123,47,138,.08); }
.lib-pencil:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(123,47,138,.2); }
.lib-pencil:disabled { opacity: .4; cursor: not-allowed; background: transparent; }
.lib-urlview[hidden], .lib-urledit[hidden] { display: none; }
.lib-urledit { display: flex; flex-direction: column; gap: 6px; margin: 0; min-height: 32px; }
.lib-urledit__row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lib-urledit .bo-input-sm { flex: 1 1 260px; min-width: 0; width: auto; }
.lib-urledit__hint { color: var(--bo-muted); font-size: .8rem; font-weight: 400; }
