/* ==========================================================================
   CRM Fotovoltaica — añadidos sobre el diseño de rbcsur (style.css).
   Aquí solo va lo que ese CRM no tenía: el selector de empresa, las tablas
   densas, el kanban, los diez pasos de obra y los semáforos.
   ========================================================================== */

:root {
    --company-accent: #4f7dff;
    --crm-ok: #22c55e;
    --crm-warn: #ff9f43;
    --crm-danger: #ef4444;
    --crm-muted: #8a8fa8;
}

/* ------------------------------------------------ selector de empresa ---- */

#topbar { position: fixed; }

/* Banda con el color de la sociedad activa: de un vistazo se sabe en qué
   empresa se está trabajando, que es el error caro del multiempresa. */
.company-accent-bar {
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 3px;
    background: var(--company-accent);
}

.company-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #e5e7eb;
    border: 1px solid #d1d5db;
    border-radius: 50px;
    padding: 5px 12px;
    font-size: .82rem;
    font-weight: 600;
    color: #1a1d2e;
    cursor: pointer;
    white-space: nowrap;
}
.company-pill:hover { background: #d1d5db; }
.company-pill::after { display: none; }

.company-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.company-name { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; }

.company-menu { min-width: 17rem; }
.company-menu form { margin: 0; }
.company-menu .dropdown-item { display: flex; align-items: center; gap: .6rem; }
.company-menu .dropdown-item.active { background: var(--accent-soft); color: var(--text-main); font-weight: 600; }

/* Marcador de empresa en las vistas del grupo */
.company-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .1rem .55rem;
    border-radius: 20px;
    background: rgba(0,0,0,.05);
    font-size: .72rem;
    font-weight: 600;
    white-space: nowrap;
}
.company-chip::before {
    content: "";
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--chip-color, var(--crm-muted));
}

.company-rail { box-shadow: inset 3px 0 0 var(--rail-color, transparent); }

/* ------------------------------------------------------ buscador global -- */

.topbar-search-form { position: relative; display: flex; gap: 0; }
.topbar-search-form > .bi-search {
    position: absolute; left: .8rem; top: 50%; transform: translateY(-50%);
    color: #9ca3af; font-size: .85rem; pointer-events: none; z-index: 1;
}
.topbar-search-form input {
    width: 230px;
    background: #1e2130;
    border: 1.5px solid rgba(255,255,255,0.1);
    border-radius: 22px 0 0 22px;
    color: #fff;
    font-size: .84rem;
    padding: .42rem .8rem .42rem 2.4rem;
    outline: none;
    transition: border-color .2s, width .25s;
}
.topbar-search-form input::placeholder { color: rgba(255,255,255,.45); }
.topbar-search-form input:focus { border-color: var(--accent); }
.topbar-search-form button {
    background: var(--accent); border: none; border-radius: 0 22px 22px 0;
    padding: 0 .9rem; color: #fff; font-size: .82rem; cursor: pointer; white-space: nowrap;
}

.search-results {
    display: block;
    position: absolute;
    top: calc(100% + .4rem);
    left: 0;
    width: 26rem;
    max-height: 24rem;
    overflow-y: auto;
    padding: .3rem;
    z-index: 1060;
}
.search-results[hidden] { display: none !important; }

.search-item { display: block; padding: .5rem .6rem; border-radius: 8px; color: inherit; text-decoration: none; }
.search-item:hover, .search-item.is-active { background: var(--accent-soft); }
.search-item strong { display: block; font-size: .85rem; }
.search-item small { display: block; font-size: .72rem; color: var(--text-muted); font-family: ui-monospace, Consolas, monospace; }

/* ---------------------------------------------------------- tablas ------- */

.crm-table-card { background: #fff; border: 1px solid rgba(0,0,0,.06); border-radius: 16px; overflow: hidden; }

.table-scroll { overflow: auto; contain: paint; max-height: calc(100vh - 22rem); }

.crm-table { width: 100%; margin: 0; font-size: .82rem; border-collapse: separate; border-spacing: 0; }
.crm-table thead th {
    position: sticky; top: 0; z-index: 2;
    background: #f7f8fb;
    padding: .6rem .75rem;
    text-align: left;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
    border-bottom: 1px solid rgba(0,0,0,.07);
}
.crm-table thead th a { color: inherit; text-decoration: none; }
.crm-table thead th a:hover { color: var(--accent); }
.crm-table tbody td { padding: .55rem .75rem; border-bottom: 1px solid rgba(0,0,0,.05); vertical-align: middle; }
.crm-table tbody tr:last-child td { border-bottom: 0; }
.crm-table tbody tr:hover { background: #f9fafc; }

.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, Consolas, "Liberation Mono", monospace; font-size: .78rem; }
.truncate { max-width: 15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cell-copy { cursor: copy; }
.cell-copy:hover { outline: 1px dashed rgba(0,0,0,.2); outline-offset: -2px; }
.cell-copy.is-copied { outline: 1px solid var(--crm-ok); outline-offset: -2px; }
.cell-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Filtros de listado */
.crm-filters {
    background: #fff;
    border: 1px solid rgba(0,0,0,.06);
    border-radius: 16px;
    padding: 1rem 1.2rem;
    margin-bottom: 1rem;
}
.crm-filters .form-label { font-size: .74rem; font-weight: 600; color: var(--text-muted); margin-bottom: .25rem; }
.crm-filters .form-control, .crm-filters .form-select { font-size: .84rem; border-radius: 10px; }

.crm-pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
                  padding: .8rem 1.2rem; border-top: 1px solid rgba(0,0,0,.06); font-size: .8rem; }
.crm-pagination .page-link { border-radius: 8px; font-size: .8rem; color: var(--text-main); }
.crm-pagination .page-item.active .page-link { background: var(--accent); border-color: var(--accent); color: #fff; }

/* -------------------------------------------------------- semáforos ------ */

.sema { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; font-size: .78rem;
        font-variant-numeric: tabular-nums; }
.sema::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--crm-muted); }
.sema.is-ok::before { background: var(--crm-ok); }
.sema.is-notice::before { background: #4f7dff; }
.sema.is-warning::before { background: var(--crm-warn); }
.sema.is-danger::before, .sema.is-expired::before { background: var(--crm-danger); }
.sema.is-expired { color: var(--crm-danger); }

.badge-soft { font-size: .7rem; font-weight: 600; padding: .25em .6em; border-radius: 20px;
              background: rgba(0,0,0,.05); color: var(--text-main); }
.badge-soft.ok { background: rgba(34,197,94,.14); color: #15803d; }
.badge-soft.warn { background: rgba(255,159,67,.16); color: #b45309; }
.badge-soft.danger { background: rgba(239,68,68,.14); color: #b91c1c; }
.badge-soft.info { background: var(--accent-soft); color: #2b4fd0; }
.badge-soft.muted { background: rgba(0,0,0,.05); color: var(--text-muted); }

/* ------------------------------------------------------------ kanban ----- */

.kanban { display: flex; gap: .85rem; overflow-x: auto; padding-bottom: .6rem; align-items: flex-start; }
.kanban-col { flex: 0 0 17.5rem; background: #eef0f6; border-radius: 14px; display: flex; flex-direction: column;
              max-height: calc(100vh - 17rem); }
.kanban-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem;
               padding: .65rem .85rem; font-size: .72rem; font-weight: 700; letter-spacing: .06em;
               text-transform: uppercase; color: var(--text-muted); }
.kanban-body { padding: 0 .55rem .55rem; overflow-y: auto; flex: 1; min-height: 3rem; }
.kanban-card { background: #fff; border-radius: 10px; border: 1px solid rgba(0,0,0,.06);
               border-left: 3px solid var(--card-accent, var(--accent)); padding: .6rem .7rem;
               margin-bottom: .5rem; font-size: .8rem; cursor: grab; text-decoration: none; color: inherit; display: block; }
.kanban-card:hover { box-shadow: 0 6px 18px rgba(0,0,0,.08); color: inherit; }
.kanban-card .title { font-weight: 600; display: block; }
.kanban-card .meta { display: flex; justify-content: space-between; gap: .5rem; margin-top: .35rem;
                     font-size: .72rem; color: var(--text-muted); }
.gu-mirror { transform: rotate(1.5deg); }

/* ------------------------------------------------- los diez pasos de obra - */

.stage-track { display: flex; gap: 3px; }
.stage-step { flex: 1; height: 6px; border-radius: 3px; background: #e3e6ef; }
.stage-step.done { background: var(--accent); opacity: .45; }
.stage-step.current { background: var(--accent); }

.stage-list { list-style: none; padding: 0; margin: 0; counter-reset: paso; }
.stage-list li { display: flex; gap: .8rem; padding: .6rem 0; border-bottom: 1px dashed rgba(0,0,0,.08); align-items: flex-start; }
.stage-list li:last-child { border-bottom: 0; }
.stage-list li::before {
    counter-increment: paso; content: counter(paso);
    flex: none; width: 1.6rem; height: 1.6rem;
    display: grid; place-items: center; border-radius: 50%;
    background: #e9ecf5; color: var(--text-muted);
    font-size: .72rem; font-weight: 700;
}
.stage-list li.done::before { background: var(--crm-ok); color: #fff; }
.stage-list li.current::before { background: var(--accent); color: #fff; }
.stage-list li.current { font-weight: 600; }

/* --------------------------------------------------------------- varios -- */

/* Bootstrap 5.3 no trae esta utilidad y sin ella .text-truncate no recorta
   dentro de un flex: el hijo no puede encogerse por debajo de su contenido. */
.min-w-0 { min-width: 0; }

/* Importes de siete cifras en las tarjetas del panel. */
.stat-value.is-money { font-size: 1.28rem; white-space: nowrap; }

.empty-state { padding: 3rem 1rem; text-align: center; color: var(--text-muted); }
.empty-state i { font-size: 2.2rem; display: block; margin-bottom: .6rem; opacity: .45; }

.demo-tag { display: inline-block; padding: .05rem .4rem; border: 1px solid currentColor; border-radius: 4px;
            font-size: .62rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
            opacity: .65; vertical-align: middle; }

.detail-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .9rem 1.6rem; }
.detail-list dt { font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
                  color: var(--text-muted); margin-bottom: .15rem; }
.detail-list dd { margin: 0; font-size: .88rem; word-break: break-word; }

.timeline-list { list-style: none; padding: 0; margin: 0; }
.timeline-list li { padding: .55rem 0; border-bottom: 1px solid rgba(0,0,0,.05); }
.timeline-list li:last-child { border-bottom: 0; }

.toast-stack { position: fixed; right: 1rem; bottom: 1rem; z-index: 1080; display: flex; flex-direction: column; gap: .5rem; }
.crm-toast { background: #1a1d2e; color: #fff; padding: .5rem .85rem; border-radius: 10px; font-size: .82rem; }

@media (max-width: 991.98px) {
    .topbar-search-form input { width: 150px; }
    .company-name { max-width: 7rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

@media print {
    #topbar, #sidebar, .page-actions { display: none !important; }
    #main-content { margin-left: 0 !important; padding-top: 0 !important; }
}

/* Acceso: el panel de marca de rbcsur ocupa toda la altura junto al formulario.
   Su hoja centra el bloque cuando va solo, así que aquí solo se estira. */
.login-wrap.login-split { align-items: stretch; }
.login-wrap.login-split .login-brand { align-items: stretch; }

/* ==========================================================================
   Manual de ayuda y carteles de sección.
   Las clases .ayuda-* son las del manual del CRM de rbcsur, traídas aquí
   porque allí viven sueltas en la cabecera de /ayuda y no en style.css.
   ========================================================================== */

/* Cartel de la cabecera de cada sección: qué hace esta pantalla. */
.seccion-intro {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .06);
    border-left: 3px solid var(--accent);
    border-radius: 14px;
    padding: .9rem 1.1rem;
    margin-bottom: 1.25rem;
}
.seccion-intro > .bi:first-child {
    flex: none;
    width: 34px; height: 34px;
    border-radius: 10px;
    display: grid; place-items: center;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 1rem;
}
.seccion-intro p { margin: 0; font-size: .85rem; line-height: 1.55; color: var(--text-muted); }
.seccion-intro p strong { color: var(--text-main); }
.seccion-intro .seccion-intro-link { font-size: .8rem; font-weight: 600; white-space: nowrap; text-decoration: none; }
.seccion-intro .btn-close { flex: none; font-size: .6rem; opacity: .35; }
.seccion-intro .btn-close:hover { opacity: .7; }

/* Cabecera del índice del manual */
.ayuda-hero {
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    color: #fff;
    border-radius: 14px;
    padding: 1.75rem 1.9rem;
    margin-bottom: 1.75rem;
}
.ayuda-hero h1 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; margin: 0 0 .35rem; }
.ayuda-hero p { margin: 0; opacity: .9; font-size: .9rem; }

.ayuda-bloque {
    background: #fff;
    border: 1px solid #e8ecf3;
    border-radius: 14px;
    padding: 1.4rem 1.6rem 1.55rem;
    margin-bottom: 1.1rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.ayuda-bloque > :last-child { margin-bottom: 0; }

.ayuda-contenido > .ayuda-texto,
.ayuda-contenido > .ayuda-scroll {
    background: #fff;
    border: 1px solid #e8ecf3;
    border-radius: 14px;
    padding: 1.15rem 1.6rem;
    margin-bottom: 1.1rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.ayuda-contenido > .ayuda-texto > :last-child { margin-bottom: 0; }

.ayuda-h2 {
    font-family: var(--font-display);
    font-size: 1.05rem; font-weight: 700; margin: 0 0 .9rem;
    display: flex; align-items: center; gap: .55rem; color: #1f2937;
    padding-bottom: .55rem; border-bottom: 2px solid var(--accent-soft);
}
.ayuda-h2 i { color: var(--accent); }

.ayuda-texto { font-size: .875rem; line-height: 1.65; color: #4b5563; }
.ayuda-texto p { margin-bottom: .7rem; }
.ayuda-texto p:last-child { margin-bottom: 0; }
.ayuda-texto strong { color: #1f2937; }

/* Pasos numerados */
.ayuda-pasos { list-style: none; counter-reset: paso; padding: 0; margin: .5rem 0 0; }
.ayuda-pasos > li {
    counter-increment: paso; position: relative; padding: 0 0 1rem 2.4rem;
    font-size: .875rem; line-height: 1.6; color: #4b5563;
    border-left: 2px dashed rgba(0, 0, 0, .1); margin-left: .85rem;
}
.ayuda-pasos > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.ayuda-pasos > li::before {
    content: counter(paso); position: absolute; left: -.9rem; top: -.15rem;
    width: 1.75rem; height: 1.75rem; border-radius: 50%;
    background: var(--accent); color: #fff; font-size: .75rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}

/* Listas con icono */
.ayuda-lista { list-style: none; padding: 0; margin: .4rem 0 0; font-size: .855rem; }
.ayuda-lista li { padding: .3rem 0 .3rem 1.5rem; position: relative; color: #4b5563; line-height: 1.6; }
.ayuda-lista li::before {
    content: "\F26E"; font-family: "bootstrap-icons"; position: absolute; left: 0; top: .3rem;
    color: var(--accent); font-size: .8rem;
}
.ayuda-lista strong { color: #1f2937; }

/* Avisos */
.ayuda-nota {
    border-radius: 10px; padding: .85rem 1rem; font-size: .83rem; line-height: 1.6;
    margin: 1rem 0 0; display: flex; gap: .7rem; align-items: flex-start;
}
.ayuda-nota i { font-size: 1rem; flex-shrink: 0; margin-top: .1rem; }
.ayuda-nota.info    { background: #eff6ff; color: #1e40af; border-left: 3px solid #3b82f6; }
.ayuda-nota.ok      { background: #ecfdf5; color: #065f46; border-left: 3px solid #10b981; }
.ayuda-nota.aviso   { background: #fffbeb; color: #92400e; border-left: 3px solid #f59e0b; }
.ayuda-nota.peligro { background: #fef2f2; color: #991b1b; border-left: 3px solid #ef4444; }
.ayuda-nota.truco   { background: #f5f3ff; color: #5b21b6; border-left: 3px solid #8b5cf6; }
.ayuda-nota strong  { font-weight: 700; }

/* Tablas de campos */
.ayuda-tabla { width: 100%; font-size: .82rem; border-collapse: collapse; margin: .6rem 0 0; }
.ayuda-tabla thead th {
    background: #f7f8fb; color: #1f2937; font-weight: 700; text-align: left;
    padding: .55rem .7rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em;
    border-bottom: 1px solid rgba(0, 0, 0, .08);
}
.ayuda-tabla tbody td { padding: .55rem .7rem; border-bottom: 1px solid rgba(0, 0, 0, .06); color: #4b5563; vertical-align: top; }
.ayuda-tabla tbody tr:last-child td { border-bottom: 0; }
.ayuda-tabla tbody tr:hover { background: #fafbfc; }
.ayuda-tabla strong { color: #1f2937; }
.ayuda-scroll { overflow-x: auto; }

/* Ruta de navegación «Menú › Sección» */
.ayuda-ruta {
    display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap;
    background: var(--accent-soft); color: var(--accent); font-weight: 600;
    padding: .35rem .7rem; border-radius: 6px; font-size: .8rem; margin-bottom: .9rem;
    text-decoration: none;
}
a.ayuda-ruta:hover { background: var(--accent); color: #fff; }

/* Tarjetas del índice */
.ayuda-card {
    display: block; background: #fbfcfe; border: 1px solid #e8ecf3; border-radius: 12px;
    padding: 1.1rem; height: 100%; text-decoration: none; transition: .15s;
}
.ayuda-card:hover { background: #fff; border-color: var(--accent); box-shadow: 0 8px 24px rgba(0, 0, 0, .07); transform: translateY(-2px); }
.ayuda-card .ic {
    width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center;
    justify-content: center; font-size: 1.05rem; margin-bottom: .65rem;
    background: var(--accent-soft); color: var(--accent);
}
.ayuda-card h3 { font-family: var(--font-display); font-size: .9rem; font-weight: 700; color: #1f2937; margin: 0 0 .3rem; }
.ayuda-card p { font-size: .78rem; color: var(--text-muted); margin: 0; line-height: 1.5; }

.ayuda-buscador { position: relative; margin-bottom: 1.5rem; }
.ayuda-buscador input {
    width: 100%; border: 1px solid rgba(0, 0, 0, .1); border-radius: 10px;
    padding: .7rem 1rem .7rem 2.5rem; font-size: .875rem; outline: none;
}
.ayuda-buscador input:focus { border-color: var(--accent); box-shadow: 0 0 0 3.5px var(--accent-soft); }
.ayuda-buscador i { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

@media (max-width: 575.98px) {
    .ayuda-bloque,
    .ayuda-contenido > .ayuda-texto,
    .ayuda-contenido > .ayuda-scroll { padding: 1.05rem 1.05rem 1.15rem; border-radius: 12px; }
}

@media print {
    .seccion-intro, .ayuda-buscador, .ficha-sidebar { display: none !important; }
    .ayuda-bloque { box-shadow: none !important; break-inside: avoid; }
}

/* ==========================================================================
   Energía Solar Canarias — marca y componentes de formulario y presupuesto.
   El naranja del logotipo (#e15025) se reserva para marcas y detalles; para
   botones con texto blanco se usa un tono más oscuro que cumple AA (5,2:1).
   ========================================================================== */

:root {
    --brand-orange: #e15025;
    --accent: #c2410c;
    --accent-hover: #a8380f;
    --accent-soft: rgba(225, 80, 37, .12);
    --menu-active-bg: rgba(225, 80, 37, .2);
    --text-muted: #5f6579;
    --crm-muted: #5f6579;
    --company-accent: #e15025;
}

/* Logotipo en la barra superior (clara) y en el acceso */
.brand-logo { height: 34px; width: auto; display: block; }
.login-logo { height: 54px; width: auto; }
.login-logo-white { height: 46px; width: auto; filter: brightness(0) invert(1); }
.login-brand::before { background: radial-gradient(circle, rgba(225,80,37,.28) 0%, transparent 70%); }
.login-brand::after  { background: radial-gradient(circle, rgba(225,80,37,.16) 0%, transparent 70%); }
.login-brand-tagline { font-family: var(--font-display); font-size: 2.1rem; font-weight: 700; color: #fff; line-height: 1.15; }
.login-brand-tagline span { background: linear-gradient(135deg, #f08a4b, var(--brand-orange)); -webkit-background-clip: text; background-clip: text; }
.login-brand-desc, .login-brand-footer { color: rgba(255,255,255,.72); }
.btn-login { background: var(--accent); }
.btn-login:hover { box-shadow: 0 8px 24px rgba(194,65,12,.35); }
.ayuda-hero { background: linear-gradient(135deg, var(--accent), #e8833a); }

/* Botón principal de acción: Nuevo, Guardar, Aceptar presupuesto */
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-accent:hover, .btn-accent:focus-visible { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-accent:active { background: var(--accent-hover) !important; color: #fff !important; }
.btn-accent:disabled { background: var(--accent); opacity: .55; color: #fff; }
.badge-soft.info { background: rgba(31,79,168,.1); color: #1f4fa8; }

/* Foco visible para teclado en todos los controles */
a:focus-visible, button:focus-visible, .btn:focus-visible, [tabindex]:focus-visible, summary:focus-visible,
.form-control:focus-visible, .form-select:focus-visible {
    outline: 3px solid rgba(194,65,12,.55);
    outline-offset: 2px;
}
.table-scroll:focus-visible { outline: 3px solid rgba(194,65,12,.45); outline-offset: -3px; }

/* Enlace para saltar al contenido */
.skip-link {
    position: absolute; left: .75rem; top: -3rem; z-index: 2000;
    background: var(--accent); color: #fff; padding: .5rem .9rem; border-radius: 8px;
    font-weight: 600; text-decoration: none; transition: top .15s;
}
.skip-link:focus { top: .6rem; color: #fff; }
#main-content:focus { outline: none; }

/* ------------------------------------------------------------ formularios */
.req { color: var(--accent); font-weight: 700; }
fieldset.dash-card { border: 0; min-width: 0; }
fieldset.dash-card > legend { float: none; width: auto; padding: 0; margin-bottom: .9rem; font-size: inherit; }
.crm-form-actions {
    display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
    padding: .9rem 0 .2rem; position: sticky; bottom: 0; z-index: 5;
    background: linear-gradient(to top, var(--content-bg) 75%, transparent);
}
.crm-form-actions form { margin: 0; }
.row-action {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; border-radius: 50%; color: var(--text-muted); text-decoration: none;
}
.row-action:hover { background: var(--accent-soft); color: var(--accent); }

/* --------------------------------------------------------- presupuestos */
.quote-lines-scroll { max-height: none; }
.quote-lines { min-width: 54rem; }
.quote-lines td { vertical-align: top; padding: .45rem .35rem; }
.quote-lines .ql-product { min-width: 17rem; }
.quote-lines input.num { text-align: right; min-width: 5.2rem; }
.quote-lines select[data-line-vat] { min-width: 6.5rem; }
.quote-line [data-line-total] { white-space: nowrap; padding-top: .7rem; }
.kit-panel { background: var(--accent-soft); border-radius: 12px; padding: .9rem 1rem; }
.quote-totals { position: sticky; top: calc(var(--topbar-height) + 1rem); }
.quote-sum { display: grid; grid-template-columns: 1fr auto; gap: .35rem 1rem; margin: 0 0 1rem; font-size: .88rem; }
.quote-sum dt { font-weight: 500; color: var(--text-muted); }
.quote-sum dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.quote-sum .input-group { max-width: 9rem; margin-left: auto; }
.quote-sum .total { font-size: 1.15rem; font-weight: 700; color: var(--text-main); border-top: 1px solid rgba(0,0,0,.08); padding-top: .45rem; }

.quote-workflow form { margin: 0; }
.quote-doc { padding: 2rem 2.2rem; }
.quote-doc-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.5rem;
                  border-bottom: 3px solid var(--brand-orange); padding-bottom: 1.2rem; margin-bottom: 1.4rem; }
.quote-doc-logo { height: 58px; width: auto; }
.quote-doc-kicker { text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; font-weight: 700; color: var(--accent); margin: 0; }
.quote-doc-number { font-size: 1.35rem; font-weight: 700; margin: 0 0 .3rem; }
.quote-doc-parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1.2rem; margin-bottom: 1.4rem; }
.quote-doc-label { text-transform: uppercase; letter-spacing: .08em; font-size: .7rem; font-weight: 700; color: var(--text-muted); margin: 0 0 .35rem; }
.quote-doc-lines { min-width: 40rem; }
.quote-doc-bottom { display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem); gap: 1.5rem; margin-top: 1.4rem; }
.quote-doc-sum { margin: 0; }
.quote-doc-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-top: 2.2rem; }
.quote-doc-sign > div { border-top: 1px solid rgba(0,0,0,.25); padding-top: .6rem; min-height: 5.5rem; }
.quote-doc-legal { margin-top: 1.6rem; border-top: 1px solid rgba(0,0,0,.08); padding-top: .8rem; font-size: .72rem; }
@media (max-width: 767.98px) {
    .quote-doc { padding: 1.2rem; }
    .quote-doc-bottom, .quote-doc-sign { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- kanban */
.kanban-title { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
                color: var(--text-muted); margin: 0; }
.kanban-card { position: relative; }
.kanban-card .stretched-title { color: var(--text-main); text-decoration: none; }
.kanban-card .stretched-title:hover { color: var(--accent); text-decoration: underline; }
.kanban-move { margin-top: .45rem; }
.kanban-move .form-select { font-size: .74rem; padding-top: .15rem; padding-bottom: .15rem; }
.kanban-hint { font-size: .74rem; color: var(--text-muted); border: 1px dashed rgba(0,0,0,.18); border-radius: 10px;
               padding: .6rem; margin: 0 0 .5rem; text-align: center; }

/* ---------------------------------------------------------------- agenda */
.is-today { box-shadow: inset 0 0 0 2px var(--brand-orange); }

/* ------------------------------------------------- barra superior móvil */
@media (max-width: 575.98px) {
    #topbar .container-fluid { gap: .35rem; padding-left: .5rem !important; padding-right: .5rem !important; flex-wrap: nowrap; }
    .brand-logo { height: 26px; }
    #topbar .navbar-brand { margin-right: 0; }
    .company-pill { padding: 4px 9px; font-size: .76rem; }
    .company-name { max-width: 5.5rem; }
    .topbar-search-form { display: none; }
    #topbar .ms-auto { gap: .5rem !important; }
}

/* ------------------------------------------------------------- impresión */
@media print {
    .no-print, .skip-link, .toast-stack, .seccion-intro, .crm-form-actions { display: none !important; }
    body { background: #fff; }
    .content-inner { padding: 0 !important; }
    .quote-doc { box-shadow: none !important; border: 0 !important; padding: 0; }
    .quote-doc .table-scroll { overflow: visible !important; max-height: none !important; }
    .quote-doc-lines { min-width: 0; }
    .quote-doc-bottom { grid-template-columns: 1fr 18rem; }
    .quote-doc-sign { grid-template-columns: 1fr 1fr; break-inside: avoid; }
    .quote-doc-head { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Restos del azul de la plantilla, en el naranja de la marca */
.login-features li i { background: rgba(225,80,37,.18); color: #f08a4b; }
.btn-login { box-shadow: 0 6px 20px rgba(194,65,12,.28); }
.brand-icon { box-shadow: 0 4px 14px rgba(225,80,37,.35); }
.brand-logo { height: 44px; }
.login-logo { height: 84px; }
.login-logo-white { height: 72px; }
.login-box-logo { margin-bottom: 1.25rem; }
@media (max-width: 575.98px) { .brand-logo { height: 32px; } }

/* Botones de aviso con contraste suficiente sobre blanco */
.btn-outline-warning { color: #8a5300; border-color: #d99a00; }
.btn-outline-warning:hover { background: #fff3cd; color: #6b4000; border-color: #d99a00; }
.btn-outline-info { color: #0b5f73; border-color: #2aa3bd; }
.btn-outline-info:hover { background: #e3f6fa; color: #08495a; border-color: #2aa3bd; }
.badge.bg-warning { color: #3d2600 !important; }
.seccion-intro .seccion-intro-link { color: var(--accent); }
:root { --bs-link-color: #c2410c; --bs-link-hover-color: #a8380f; --bs-link-color-rgb: 194,65,12; --bs-link-hover-color-rgb: 168,56,15; }

/* En el móvil el usuario queda en su inicial: nombre, rol y flecha fuera */
@media (max-width: 575.98px) {
    .user-pill { padding: 0 !important; gap: 0 !important; background: transparent !important; border: 0 !important; }
    .user-pill > :not(.avatar-circle) { display: none !important; }
    .company-pill .chevron-icon { display: none; }
    #sidebar-toggle { margin-left: 0 !important; }
}

/* Acceso: logo grande y lema, sin más texto */
.login-box-logo img.login-logo, img.login-logo { height: auto; width: min(100%, 420px); }
.login-brand-logo img.login-logo-white { height: auto; width: min(100%, 560px); filter: none; }
.login-brand-tagline { font-size: 2.6rem; }
.login-brand-logo img.login-logo-white { width: 100%; max-width: 620px; }
@media (min-width: 768px) {
    .login-box-logo { margin-inline: -60px; text-align: center; }
    .login-box-logo img.login-logo { width: 100%; max-width: 520px; }
}
/* Logo del acceso aún mayor: el panel de marca lo pone en grande y centrado */
.login-brand-logo { justify-content: center; }
.login-brand-logo img.login-logo-white { width: 100%; max-width: none; }
@media (min-width: 768px) {
    .login-box-logo { margin-inline: -100px; }
    .login-box-logo img.login-logo { width: 100%; max-width: 600px; }
}
@media (max-width: 767.98px) {
    .login-box-logo img.login-logo { width: 100%; max-width: none; }
}
/* Acceso: el logo solo en el panel oscuro, a un tamaño medido; en el móvil, encima del formulario */
.login-brand-logo { justify-content: flex-start; }
.login-brand-logo img.login-logo-white { width: min(100%, 400px); }
@media (max-width: 767.98px) {
    .login-box-logo { margin-inline: 0; }
    .login-box-logo img.login-logo { width: min(100%, 260px); }
}

/* DataTables dentro de las tarjetas de tabla (pantalla de registros):
   aire para los controles y fechas en una sola línea, alineadas a la izquierda. */
.crm-table-card .dt-container > .row:not(.dt-layout-table) {
    margin: 0;
    padding: .75rem 1rem;
}
.crm-table-card .dt-paging .page-link { color: var(--accent); }
.crm-table-card .dt-paging .active > .page-link {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.crm-table-card .dt-container .dt-type-date {
    text-align: left;
    white-space: nowrap;
}

/* Visor de cambios: el texto de lo que cambió se lee entero, en varias líneas. */
.crm-table td.audit-changes {
    min-width: 18rem;
    max-width: 34rem;
    white-space: normal;
    line-height: 1.45;
}

/* ==========================================================================
   Facturación: marca de agua del borrador, huella y barra de lo facturado.
   ========================================================================== */

.quote-doc.is-draft { position: relative; overflow: hidden; }
.quote-doc.is-draft::before {
    content: attr(data-watermark);
    position: absolute; inset: 40% -10% auto; text-align: center;
    transform: rotate(-18deg);
    font-size: clamp(1.4rem, 4vw, 2.6rem); font-weight: 800; letter-spacing: .12em;
    color: rgba(194, 65, 12, .09); pointer-events: none;
}
.invoice-hash { margin-top: 1.2rem; padding: .7rem .9rem; border-radius: 10px; background: #f6f7fb; word-break: break-all; }
.invoice-hash code { font-size: .72rem; color: var(--text-main); }
.rectify-box > summary { list-style: none; cursor: pointer; }
.rectify-box > summary::-webkit-details-marker { display: none; }
.rectify-box[open] { flex-basis: 100%; max-width: 32rem; }

.billing-bar { height: 10px; border-radius: 99px; background: #eceef4; overflow: hidden; min-width: 10rem; }
.billing-bar > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

/* Imagen del diseño dentro del presupuesto y de la propuesta. */
.quote-doc-plan { margin: 1.4rem 0 0; }
.quote-doc-plan img { width: 100%; height: auto; border-radius: 10px; display: block; }
.quote-doc-plan figcaption { margin-top: .4rem; }

/* Miniatura en los listados. */
.cell-thumb { width: 72px; height: 46px; object-fit: cover; border-radius: 6px; display: block; background: #e9ecf3; }
.cell-thumb.is-empty { display: grid; place-items: center; color: var(--text-muted); }

/* ==========================================================================
   Planificaciones: diseñador sobre la vista cenital de la cubierta.
   ========================================================================== */

.planner { display: flex; flex-direction: column; gap: .75rem; }
.planner-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: .35rem;
    background: #fff; border: 1px solid rgba(0, 0, 0, .06); border-radius: 14px; padding: .45rem .6rem;
}
.planner-tools { display: flex; flex-wrap: wrap; gap: .25rem; }
.planner-tool {
    width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent;
    background: transparent; color: var(--text-main); display: inline-grid; place-items: center; font-size: 1.05rem;
}
.planner-tool:hover { background: #f1f3f8; }
.planner-tool:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.planner-tool[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: rgba(194, 65, 12, .35); }
.planner-sep { width: 1px; height: 24px; background: rgba(0, 0, 0, .1); margin: 0 .25rem; }
.planner-status.is-ok { color: #1f7a3a; }
.planner-status.is-warn { color: #9a5b00; }
.planner-status.is-danger { color: #b42318; }

.planner-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: .75rem; align-items: start; }
.planner-stage {
    position: relative; background: #1d232b; border-radius: 14px; overflow: hidden;
    height: calc(100vh - 230px); min-height: 460px;
}
.planner-svg { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; cursor: default; }
.planner-svg[data-tool="panel"], .planner-svg[data-tool="array"], .planner-svg[data-tool="zone"],
.planner-svg[data-tool="obstacle"], .planner-svg[data-tool="measure"] { cursor: crosshair; }
.planner-svg[data-tool="pan"] { cursor: grab; }
.planner-hint {
    position: absolute; left: .75rem; bottom: .6rem; right: 14rem; margin: 0;
    color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); pointer-events: none;
}
.planner-legend {
    position: absolute; right: .75rem; bottom: .55rem; display: flex; gap: .7rem;
    background: rgba(15, 17, 23, .7); color: #fff; padding: .25rem .6rem; border-radius: 99px; pointer-events: none;
}
.planner-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }
.planner-legend .lg-panel { background: #1c3460; border: 1px solid #d7e0ee; }
.planner-legend .lg-zone { border: 1.5px dashed #fff; }
.planner-legend .lg-obstacle { background: rgba(198, 40, 40, .55); }

/* Dibujo */
.pl-zone { fill: rgba(255, 255, 255, .08); stroke: rgba(255, 255, 255, .9); stroke-dasharray: 8 6; vector-effect: non-scaling-stroke; }
.pl-obstacle { fill: url(#plHatch); stroke: rgba(198, 40, 40, .95); vector-effect: non-scaling-stroke; }
.pl-zone.sel, .pl-obstacle.sel { stroke: #ffb020; stroke-width: 3px; }
.pl-panel-body { fill: url(#plCell); stroke: #d7e0ee; stroke-width: 1.2px; vector-effect: non-scaling-stroke; }
.pl-panel-grid { fill: none; stroke: rgba(160, 185, 225, .5); stroke-width: .6px; }
.pl-panel.sel .pl-panel-body { stroke: #ffb020; stroke-width: 2.5px; }
.pl-panel.ghost { opacity: .6; pointer-events: none; }
.pl-draft { fill: rgba(255, 255, 255, .1); stroke: #fff; stroke-width: 2px; stroke-dasharray: 6 4; }
.pl-draft.is-obstacle { stroke: #ff6b6b; }
.pl-vertex { fill: #fff; stroke: var(--accent); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.pl-vertex.first { fill: var(--accent); }
.pl-marquee { fill: rgba(255, 176, 32, .12); stroke: #ffb020; stroke-width: 1.5px; stroke-dasharray: 5 4; }
.pl-measure { stroke: #ffd400; stroke-width: 2.5px; }
.pl-measure-label { fill: #ffd400; font-weight: 700; paint-order: stroke; stroke: rgba(0, 0, 0, .75); stroke-width: 3px; }
.pl-overlay { pointer-events: none; }

/* Panel lateral */
.planner-side { display: flex; flex-direction: column; gap: .75rem; max-height: calc(100vh - 230px); min-height: 460px; overflow: auto; }
.planner-card { background: #fff; border: 1px solid rgba(0, 0, 0, .06); border-radius: 14px; padding: .85rem .95rem; margin: 0; min-width: 0; }
.planner-card .form-label { font-size: .75rem; margin-bottom: .2rem; color: var(--text-muted); }
.planner-card-title { font-size: .82rem; font-weight: 700; display: flex; align-items: center; gap: .45rem; margin-bottom: .6rem; float: none; width: 100%; }
.planner-card-title i { color: var(--accent); }
.planner-figures { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem .75rem; margin: 0 0 .6rem; }
.planner-figures dt { font-size: .7rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.planner-figures dd { margin: 0; font-size: 1rem; font-weight: 700; font-family: 'Space Grotesk', 'DM Sans', sans-serif; }

/* Elegir la imagen: satélite o foto */
.planner-source { position: absolute; inset: 0; background: rgba(15, 17, 23, .55); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 3; }
.planner-source[hidden] { display: none; }
.planner-source-card { background: #fff; border-radius: 16px; padding: 1rem 1.1rem; width: min(860px, 100%); max-height: 100%; overflow: auto; }
.planner-tabs { display: flex; gap: .3rem; border-bottom: 1px solid rgba(0, 0, 0, .08); }
.planner-tabs button { border: 0; background: none; padding: .5rem .8rem; font-size: .85rem; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; }
.planner-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.planner-map { position: relative; height: 420px; border-radius: 12px; overflow: hidden; background: #1d232b; touch-action: none; cursor: grab; }
.planner-map:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.planner-map canvas { width: 100%; height: 100%; display: block; }
.planner-map-cross { position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; pointer-events: none; }
.planner-map-cross::before, .planner-map-cross::after { content: ""; position: absolute; background: #ffd400; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); }
.planner-map-cross::before { left: 16px; top: 0; width: 2px; height: 34px; }
.planner-map-cross::after { top: 16px; left: 0; height: 2px; width: 34px; }
.planner-map-zoom { position: absolute; right: .6rem; top: .6rem; display: flex; flex-direction: column; gap: .3rem; }
.planner-map-zoom button { width: 34px; height: 34px; border-radius: 10px; border: 0; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }

/* Propuesta */
.plan-figure { display: flex; gap: .6rem; align-items: center; padding: .6rem .7rem; border-radius: 12px; background: #f6f7fb; height: 100%; }
.plan-figure > i { font-size: 1.2rem; color: var(--accent); }
.plan-figure-label { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.plan-figure-value { font-size: 1.05rem; font-family: 'Space Grotesk', 'DM Sans', sans-serif; }

@media (max-width: 1199.98px) {
    .planner-body { grid-template-columns: 1fr; }
    .planner-side { max-height: none; min-height: 0; overflow: visible; }
    .planner-stage { height: 68vh; min-height: 380px; }
}
@media (max-width: 575.98px) {
    .planner-hint { right: .75rem; bottom: 2.4rem; }
    .planner-map { height: 300px; }
}
@media print {
    .planner-toolbar, .planner-side, .planner-hint, .rectify-box, .no-print { display: none !important; }
    .invoice-hash { background: none; padding: 0; }
    .plan-figure { background: none; border: 1px solid #ddd; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
