/*
 * Estratosfera - capa visual propia.
 * Mismo sistema que Apptify (apptify_modern.css): tokens, barra lateral fija,
 * cabeceras con etiqueta azul, superficies suaves, tablas y modales redondeados.
 */

:root {
    --app-bg: #f6f8fc;
    --app-text: #101828;
    --app-muted: #667085;
    --app-border: rgba(149, 164, 190, .24);
    --app-border-soft: rgba(149, 164, 190, .16);
    --app-surface: rgba(255, 255, 255, .94);
    --app-radius: 18px;
    --app-radius-sm: 12px;
    --app-shadow-soft: 0 1rem 2.8rem rgba(29, 52, 88, .07);
    --app-shadow-float: 0 1.25rem 3.2rem rgba(29, 52, 88, .13);
    --app-blue: #0867f9;
    --app-cyan: #00a9c4;
    --app-green: #18a66d;
    --app-amber: #d97706;
    --app-red: #d92d20;
    --app-focus: 0 0 0 .22rem rgba(8, 103, 249, .15);
    --font-primary: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --app-sidebar-width: 264px;
    --app-sidebar-border: #e7ebf1;
    --app-sidebar-text: #1f2a3d;
    --app-sidebar-muted: #6b778c;
    --app-sidebar-hover: #f2f5f9;
    --app-sidebar-active: #eaf2ff;
    --app-sidebar-active-text: #0a58ca;
    --bs-primary: #0867f9;
    --bs-primary-rgb: 8, 103, 249;
    --bs-link-color: #0867f9;
    --bs-link-color-rgb: 8, 103, 249;
}

html,
body {
    background: var(--app-bg);
    color: var(--app-text);
    font-family: var(--font-primary);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body::before {
    position: fixed;
    z-index: -1;
    inset: 0;
    background:
        radial-gradient(circle at 88% 0, rgba(0, 190, 197, .06), transparent 31rem),
        radial-gradient(circle at 8% 8%, rgba(40, 113, 255, .065), transparent 34rem),
        var(--app-bg);
    content: "";
    pointer-events: none;
}

::selection {
    background: rgba(8, 103, 249, .18);
}

.tabular {
    font-variant-numeric: tabular-nums;
}

/* Barra superior (móvil y tablet): solo botón de menú y logo. */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: 64px;
    padding: .55rem .9rem;
    border-bottom: 1px solid rgba(149, 164, 190, .18);
    background: rgba(255, 255, 255, .82);
    box-shadow: 0 .4rem 1.4rem rgba(29, 52, 88, .035);
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
}

.app-topbar .app-menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(149, 164, 190, .23);
    border-radius: 14px;
    background: rgba(255, 255, 255, .84);
    box-shadow: 0 .35rem 1rem rgba(29, 52, 88, .06);
    color: #344054;
    font-size: 1.25rem;
}

.app-topbar img {
    height: 34px;
}

/* Barra lateral */
#appSidebar {
    --bs-offcanvas-width: min(288px, calc(100vw - 3rem));
    border-right: 1px solid var(--app-sidebar-border) !important;
    background: #fff;
    box-shadow: 0 1.25rem 3rem rgba(15, 32, 59, .16);
    color: var(--app-sidebar-text);
}

#appSidebar .offcanvas-header {
    min-height: 64px;
    padding: .75rem .9rem .5rem 1.15rem;
}

.app-sidebar-brand img {
    display: block;
    height: 30px;
}

#appSidebar .btn-close {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 8px;
    background-size: 11px;
    opacity: .5;
}

#appSidebar .offcanvas-body {
    display: flex;
    flex-direction: column;
    padding: .25rem .75rem .75rem;
    overflow: hidden;
}

.app-sidebar-workspace {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin: 0 0 .9rem;
    padding: .55rem .65rem;
    border: 1px solid var(--app-sidebar-border);
    border-radius: 10px;
    background: #f8fafc;
}

.app-sidebar-workspace-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--app-sidebar-active);
    color: var(--app-blue);
    font-size: 15px;
}

.app-sidebar-workspace strong,
.app-sidebar-workspace small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-sidebar-workspace strong {
    font-size: 13.5px;
    font-weight: 600;
}

.app-sidebar-workspace small {
    color: var(--app-sidebar-muted);
    font-size: 12px;
}

.app-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
}

.app-nav .nav {
    gap: 2px;
}

.app-menu-section {
    margin: 1.1rem 0 .3rem;
    padding: 0 .65rem;
    color: #8a94a6;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.app-nav .nav-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    width: 100%;
    min-height: 36px;
    padding: .45rem .65rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--app-sidebar-text);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    transition: background-color .15s ease, color .15s ease;
}

.app-nav .nav-link > i {
    flex: 0 0 20px;
    width: 20px;
    color: var(--app-sidebar-muted);
    font-size: 17px;
    text-align: center;
}

.app-nav .nav-link:hover {
    background: var(--app-sidebar-hover);
    color: #0f172a;
}

.app-nav .nav-link.active {
    background: var(--app-sidebar-active);
    color: var(--app-sidebar-active-text);
    font-weight: 600;
}

.app-nav .nav-link.active > i {
    color: var(--app-blue);
}

.app-nav .nav-link .badge {
    margin-left: auto;
}

.app-sidebar-footer {
    display: grid;
    gap: .35rem;
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px solid var(--app-sidebar-border);
}

.app-sidebar-account {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .4rem .4rem .1rem .45rem;
}

.app-account-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--app-blue), var(--app-cyan));
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.app-account-text {
    flex: 1 1 auto;
    min-width: 0;
}

.app-account-name {
    font-size: 13.5px;
    font-weight: 600;
}

.app-account-role {
    color: var(--app-sidebar-muted);
    font-size: 12px;
}

.app-account-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--app-sidebar-muted);
}

.app-account-action:hover {
    background: var(--app-sidebar-hover);
    color: #0f172a;
}

@media (min-width: 1200px) {
    #appSidebar {
        width: var(--app-sidebar-width) !important;
        visibility: visible !important;
        transform: none !important;
        box-shadow: none;
    }

    #appSidebar .btn-close,
    .app-topbar {
        display: none !important;
    }

    .app-main {
        padding-left: var(--app-sidebar-width);
    }

    #alertsContainer {
        left: var(--app-sidebar-width);
    }
}

/* Páginas */
.app-page {
    max-width: 1540px;
    margin: 0 auto;
    padding: clamp(1.15rem, 2.3vw, 2rem) clamp(.85rem, 2.2vw, 2rem) 3rem;
}

.app-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 1.35rem;
}

.app-page-header .app-eyebrow {
    display: block;
    margin-bottom: .45rem;
    color: var(--app-blue);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .035em;
}

.app-page-header h1 {
    margin: 0;
    color: var(--app-text);
    font-size: clamp(1.75rem, 3vw, 2.4rem);
    font-weight: 650;
    letter-spacing: -.04em;
    line-height: 1.04;
}

.app-page-header p {
    max-width: 56rem;
    margin: .65rem 0 0;
    color: var(--app-muted);
    font-size: .94rem;
}

.app-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

/* Superficies */
.app-card {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-soft);
}

.app-card-body {
    padding: clamp(1rem, 2vw, 1.35rem);
}

.app-card + .app-card,
.app-grid + .app-card,
.app-card + .app-grid {
    margin-top: 1.1rem;
}

.app-grid {
    display: grid;
    gap: 1.1rem;
}

.app-grid-2 {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
}

.app-grid-2-even {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-table-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--app-border-soft);
}

.app-table-title {
    position: relative;
    display: grid;
    gap: .18rem;
    min-width: 0;
    padding-left: .8rem;
}

.app-table-title::before {
    position: absolute;
    top: .12rem;
    bottom: .12rem;
    left: 0;
    width: 4px;
    border-radius: 99px;
    background: linear-gradient(180deg, #79adff, #78ded4);
    content: "";
}

.app-table-title span {
    color: #7b8799;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.app-table-title h2 {
    margin: 0;
    color: #0f172a;
    font-size: 1.06rem;
    font-weight: 650;
    letter-spacing: -.015em;
}

.app-table-title p {
    margin: 0;
    color: var(--app-muted);
    font-size: .84rem;
}

.app-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

.app-toolbar .form-control,
.app-toolbar .form-select {
    width: auto;
    min-width: 170px;
}

.app-toolbar .app-search {
    min-width: 240px;
}

.app-data-table {
    margin: 0;
}

.app-data-table > thead > tr > th {
    padding: .85rem 1rem;
    border-color: var(--app-border-soft);
    background: #f6f8fb;
    color: #667085;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .035em;
    text-transform: uppercase;
    white-space: nowrap;
}

.app-data-table > tbody > tr > td {
    padding: .8rem 1rem;
    border-color: var(--app-border-soft);
    color: #344054;
}

.app-data-table > tbody > tr:nth-child(even) > * {
    background: #fbfcfe;
}

.app-data-table > tbody > tr:hover > * {
    background: #f3f7fd;
}

.app-data-table .is-clickable {
    cursor: pointer;
}

.app-data-table .app-check-col {
    width: 42px;
}

.app-cell-title {
    color: #1d2939;
    font-weight: 600;
}

.app-cell-sub {
    color: #98a2b3;
    font-size: .78rem;
}

/* Columna principal de un listado: legible también en móvil (la tabla hace scroll). */
.app-cell-main {
    min-width: 260px;
}

.app-cell-main .app-cell-sub {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.app-empty {
    padding: 3rem 1rem;
    color: var(--app-muted);
    text-align: center;
}

.app-empty i {
    display: block;
    margin-bottom: .6rem;
    color: #b4c0d3;
    font-size: 2rem;
}

.app-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .85rem 1.15rem;
    border-top: 1px solid var(--app-border-soft);
    color: var(--app-muted);
    font-size: .84rem;
}

/* Etiquetas de grupo, categoría y estado */
.app-tag {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    max-width: 100%;
    padding: .2rem .55rem;
    border-radius: 99px;
    background: #f2f4f7;
    color: #344054;
    font-size: .76rem;
    font-weight: 600;
    white-space: nowrap;
}

.app-tag::before {
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tag-color, #98a2b3);
    content: "";
}

.app-tag.is-empty {
    background: transparent;
    color: #98a2b3;
    font-weight: 500;
}

/* Análisis: tabla área → grupo → artículo con columnas de periodo. */
.app-pivot-wrap {
    max-height: 70vh;
}

.app-pivot th,
.app-pivot td {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.app-pivot thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.app-pivot th:first-child,
.app-pivot td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 280px;
    max-width: 380px;
    overflow: hidden;
    text-overflow: ellipsis;
    background: #fff;
}

.app-pivot thead th:first-child {
    z-index: 3;
}

.app-data-table.app-pivot > tbody > tr:nth-child(even) > * {
    background: #fff;
}

.app-pivot .pv-area > td {
    background: #f3f7fd !important;
    color: #0f172a;
    font-weight: 650;
}

.app-pivot .pv-group > td {
    background: #fafbfd !important;
    font-weight: 600;
}

.app-pivot .pv-group > td:first-child {
    padding-left: 2rem;
}

.app-pivot .pv-article > td:first-child {
    padding-left: 3.6rem;
    color: #475467;
}

.app-pivot .pv-total > td {
    border-top: 2px solid var(--app-border);
    background: #f6f8fb !important;
    font-weight: 700;
}

.app-pivot .pv-toggle {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font-weight: inherit;
}

.app-pivot .pv-toggle .bi {
    display: inline-block;
    margin-right: .35rem;
    color: #98a2b3;
    transition: transform .15s ease;
}

.app-pivot .pv-toggle[aria-expanded="true"] .bi {
    transform: rotate(90deg);
}

.app-pivot .pv-zero {
    color: #d0d5dd;
}

.app-pivot .pv-col-total {
    border-left: 1px solid var(--app-border);
    font-weight: 650;
}

/* Estacionalidad: 12 casillas (ene–dic) coloreadas según el índice del mes. */
.app-heatstrip {
    display: grid;
    grid-template-columns: repeat(12, 16px);
    gap: 2px;
}

.app-heatstrip span {
    height: 16px;
    border-radius: 3px;
    background: rgba(8, 103, 249, var(--a, 0));
    box-shadow: inset 0 0 0 1px rgba(149, 164, 190, .2);
}

/* Comparativa de proveedores */
.app-badge-best,
.app-badge-fast {
    display: inline-block;
    padding: .1rem .45rem;
    border-radius: 99px;
    font-size: .68rem;
    font-weight: 700;
    white-space: nowrap;
}

.app-badge-best { background: #e7f7ef; color: #1b7f53; }
.app-badge-fast { background: #eaf2ff; color: #0a58ca; }

.app-data-table .sp-article > td {
    background: #f6f8fb !important;
    border-top: 2px solid var(--app-border-soft);
}

.app-data-table .sp-supplier > td:first-child {
    padding-left: 2rem;
}

/* Etiqueta pulsable para cambiar grupo/área desde la fila. */
.app-tag-button {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: 2px 4px 2px 0;
    border: 1px dashed transparent;
    border-radius: 99px;
    background: transparent;
}

.app-tag-button > .bi {
    color: #98a2b3;
    font-size: .7rem;
    opacity: 0;
    transition: opacity .15s ease;
}

.app-tag-button:hover,
.app-tag-button:focus-visible,
.app-tag-button[aria-expanded="true"] {
    border-color: rgba(8, 103, 249, .35);
    outline: none;
}

.app-tag-button:hover > .bi,
.app-tag-button:focus-visible > .bi,
.app-tag-button[aria-expanded="true"] > .bi,
.app-tag-button:has(.is-empty) > .bi {
    opacity: 1;
}

.app-tag-button .app-tag.is-empty {
    color: var(--app-blue);
}

.app-context-menu {
    position: fixed;
    z-index: 1060;
    min-width: 210px;
}

.app-inline-menu {
    position: fixed;
    z-index: 1060;
    max-height: min(360px, 60vh);
    overflow-y: auto;
}

.app-inline-menu .dropdown-item.active {
    background: #eaf2ff;
}

.app-status {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .2rem .55rem;
    border-radius: 99px;
    font-size: .74rem;
    font-weight: 650;
    white-space: nowrap;
}

.app-status.is-ok, .app-status.is-done { background: #e7f7ef; color: #1b7f53; }
.app-status.is-review, .app-status.is-queued { background: #fff4e0; color: #a15c07; }
.app-status.is-running { background: #eaf2ff; color: #0a58ca; }
.app-status.is-duplicate { background: #f2f4f7; color: #475467; }
.app-status.is-error, .app-status.is-failed { background: #fdecea; color: #b42318; }

/* KPIs, igual que el resumen del dashboard de Apptify */
.app-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border: 1px solid rgba(149, 164, 190, .22);
    border-radius: 22px;
    background: rgba(255, 255, 255, .83);
    box-shadow: 0 1.15rem 3rem rgba(29, 52, 88, .07);
    backdrop-filter: blur(16px);
}

.app-kpi {
    min-width: 0;
    padding: 1.15rem 1.5rem 1.2rem;
}

.app-kpi + .app-kpi {
    border-left: 1px solid var(--app-border-soft);
}

.app-kpi-label {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    color: var(--app-muted);
    font-size: .78rem;
    font-weight: 650;
}

.app-kpi-label i {
    color: var(--app-blue);
    font-size: .95rem;
}

.app-kpi-value {
    margin-top: .5rem;
    color: #0f172a;
    font-size: 2rem;
    font-variant-numeric: tabular-nums;
    font-weight: 650;
    letter-spacing: -.045em;
    line-height: 1.05;
    white-space: nowrap;
}

.app-kpi-note {
    margin-top: .45rem;
    color: #98a2b3;
    font-size: .76rem;
}

.app-chart {
    width: 100%;
    height: 320px;
}

.app-chart-sm {
    height: 260px;
}

/* Tareas pendientes del dashboard */
.app-todo {
    display: grid;
    gap: .5rem;
}

.app-todo-item {
    display: flex;
    align-items: center;
    gap: .8rem;
    width: 100%;
    padding: .75rem .9rem;
    border: 1px solid var(--app-border-soft);
    border-radius: 14px;
    background: #fbfcfe;
    color: #344054;
    text-align: left;
}

.app-todo-item:hover {
    border-color: rgba(8, 103, 249, .3);
    background: #f7faff;
}

.app-todo-item i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    height: 34px;
    border-radius: 11px;
    background: #edf5ff;
    color: var(--app-blue);
}

.app-todo-item strong {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}

.app-todo-item.is-done i {
    background: #eaf8f1;
    color: var(--app-green);
}

/* Zona de carga (patrón de carga de archivos de la app) */
.app-dropzone {
    display: grid;
    place-items: center;
    gap: .4rem;
    width: 100%;
    padding: 2.2rem 1rem;
    border: 2px dashed rgba(8, 103, 249, .3);
    border-radius: 18px;
    background: #f7faff;
    color: #475467;
    text-align: center;
    transition: border-color .15s ease, background-color .15s ease;
}

.app-dropzone:hover,
.app-dropzone:focus-visible,
.app-dropzone.is-dragging {
    border-color: var(--app-blue);
    background: #edf4ff;
    outline: none;
}

.app-dropzone i {
    color: var(--app-blue);
    font-size: 2rem;
}

.app-dropzone strong {
    color: #1d2939;
    font-size: 1rem;
}

.app-upload-list {
    display: grid;
    gap: .5rem;
    margin-top: 1rem;
}

.app-upload-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .75rem;
    padding: .65rem .8rem;
    border: 1px solid var(--app-border-soft);
    border-radius: 12px;
    background: #fff;
}

.app-upload-item .progress {
    height: 6px;
    margin-top: .35rem;
}

/* Barra de acciones masivas */
.app-bulkbar {
    position: sticky;
    bottom: 1rem;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    margin-top: 1rem;
    padding: .7rem .9rem;
    border: 1px solid rgba(8, 103, 249, .25);
    border-radius: 16px;
    background: rgba(255, 255, 255, .97);
    box-shadow: var(--app-shadow-float);
}

.app-bulkbar strong {
    color: var(--app-blue);
}

/* Botones */
.btn {
    border-radius: 12px;
    font-weight: 600;
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease, color .18s ease, transform .18s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:has(> i) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
}

.btn-primary {
    --bs-btn-bg: var(--app-blue);
    --bs-btn-border-color: var(--app-blue);
    --bs-btn-hover-bg: #075bdc;
    --bs-btn-hover-border-color: #075bdc;
    --bs-btn-active-bg: #064fbf;
    --bs-btn-disabled-bg: var(--app-blue);
    --bs-btn-disabled-border-color: var(--app-blue);
    box-shadow: 0 .45rem 1rem rgba(8, 103, 249, .18);
}

.btn-outline-primary {
    --bs-btn-color: var(--app-blue);
    --bs-btn-border-color: rgba(8, 103, 249, .32);
    --bs-btn-hover-bg: #edf4ff;
    --bs-btn-hover-color: #075bdc;
    --bs-btn-hover-border-color: rgba(8, 103, 249, .18);
}

.btn-light,
.btn-outline-secondary {
    --bs-btn-color: #475467;
    --bs-btn-bg: rgba(255, 255, 255, .84);
    --bs-btn-border-color: rgba(149, 164, 190, .3);
    --bs-btn-hover-color: #1e293b;
    --bs-btn-hover-bg: #f1f5f9;
    --bs-btn-hover-border-color: rgba(149, 164, 190, .45);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid rgba(149, 164, 190, .28);
    border-radius: 12px;
    background: #f8fafc;
    color: #475467;
}

/* Formularios */
.form-control,
.form-select,
.input-group-text {
    min-height: 42px;
    border-color: rgba(149, 164, 190, .3);
    border-radius: 13px;
    background-color: rgba(255, 255, 255, .92);
    color: #27364b;
}

.form-floating > .form-control,
.form-floating > .form-select {
    min-height: 56px;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(8, 103, 249, .55);
    background-color: #fff;
    box-shadow: var(--app-focus);
}

.form-control-color {
    width: 56px;
    padding: .3rem;
}

.form-floating > label {
    color: #7a879a;
}

.form-check-input:checked {
    border-color: var(--app-blue);
    background-color: var(--app-blue);
}

.form-check-input:focus {
    box-shadow: var(--app-focus);
}

.app-password {
    position: relative;
}

.app-password .form-control {
    padding-right: 3rem;
}

.app-password-toggle {
    position: absolute;
    top: 50%;
    right: .55rem;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #667085;
    transform: translateY(-50%);
}

.app-password-toggle:hover {
    background: #f2f5f9;
}

/* Pestañas de sección (patrón process-detail-tabs) */
.process-detail-tabs {
    gap: .35rem;
    margin-bottom: 1rem;
}

.process-detail-tabs .nav-link {
    border-radius: 12px;
    color: #667085;
    font-weight: 600;
}

.process-detail-tabs .nav-link.active {
    background: #eaf2ff;
    color: var(--app-blue);
}

/* Menús, modales y avisos */
.dropdown-menu {
    padding: .5rem;
    border-color: var(--app-border);
    border-radius: 15px;
    box-shadow: var(--app-shadow-float);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: .55rem;
    min-height: 38px;
    border-radius: 10px;
    color: #344054;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: #f1f6fd;
    color: var(--app-blue);
}

.dropdown-item.text-danger:hover {
    background: #fdecea;
    color: var(--app-red) !important;
}

.modal-content {
    overflow: hidden;
    border: 1px solid rgba(149, 164, 190, .2);
    border-radius: 24px;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 2rem 5rem rgba(15, 32, 59, .2);
}

.modal-header,
.modal-footer {
    padding: 1.15rem 1.35rem;
    border-color: var(--app-border-soft);
}

.modal-body {
    padding: 1.35rem;
}

.modal-title {
    font-weight: 650;
    letter-spacing: -.02em;
}

.modal-header .app-eyebrow {
    display: block;
    margin-bottom: .3rem;
    color: var(--app-blue);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .035em;
}

.modal-footer .btn-secondary {
    --bs-btn-color: #475467;
    --bs-btn-bg: rgba(255, 255, 255, .84);
    --bs-btn-border-color: rgba(149, 164, 190, .3);
    --bs-btn-hover-color: #1e293b;
    --bs-btn-hover-bg: #f1f5f9;
    --bs-btn-hover-border-color: rgba(149, 164, 190, .45);
}

.modal-backdrop.show {
    opacity: .42;
}

.alert {
    border-radius: 15px;
}

#alertsContainer {
    position: fixed;
    right: 0;
    bottom: 1rem;
    left: 0;
    z-index: 2000;
    display: grid;
    justify-items: center;
    gap: .5rem;
    pointer-events: none;
}

#alertsContainer .alert {
    min-width: min(420px, calc(100vw - 2rem));
    margin: 0;
    box-shadow: var(--app-shadow-float);
    pointer-events: auto;
}

.app-link-box {
    display: flex;
    gap: .5rem;
}

.app-link-box input {
    font-family: ui-monospace, Consolas, monospace;
    font-size: .8rem;
}

/* Cargando */
.app-loader {
    display: grid;
    place-items: center;
    gap: .6rem;
    padding: 4rem 1rem;
    color: var(--app-muted);
}

/* Ayuda */
.app-wiki h2 {
    margin: 1.6rem 0 .6rem;
    font-size: 1.15rem;
    font-weight: 650;
    letter-spacing: -.02em;
}

.app-wiki h2:first-child {
    margin-top: 0;
}

.app-wiki p,
.app-wiki li {
    color: #344054;
    line-height: 1.6;
}

/* Acceso (login y activación), como las pantallas de cuenta de Apptify */
.auth-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 1.5rem 1rem;
}

.auth-card {
    width: min(440px, 100%);
    padding: clamp(1.5rem, 4vw, 2.4rem);
    border: 1px solid var(--app-border);
    border-radius: 24px;
    background: var(--app-surface);
    box-shadow: var(--app-shadow-soft);
}

.auth-logo {
    display: block;
    height: 40px;
    margin: 0 auto 1.6rem;
}

.auth-card h1 {
    margin-bottom: .4rem;
    font-size: 1.55rem;
    font-weight: 650;
    letter-spacing: -.03em;
    text-align: center;
}

.auth-card .auth-sub {
    margin-bottom: 1.5rem;
    color: var(--app-muted);
    text-align: center;
}

@media (prefers-reduced-motion: no-preference) {
    .app-view.is-active > .app-page {
        animation: app-enter .24s ease-out both;
    }

    @keyframes app-enter {
        from { opacity: .5; transform: translateY(4px); }
        to { opacity: 1; transform: translateY(0); }
    }
}

.app-view {
    display: none;
}

.app-view.is-active {
    display: block;
}

@media (max-width: 1199.98px) {
    .app-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .app-kpi:nth-child(3) {
        border-left: 0;
    }

    .app-kpi:nth-child(n+3) {
        border-top: 1px solid var(--app-border-soft);
    }

    .app-grid-2,
    .app-grid-2-even {
        grid-template-columns: 1fr;
    }
}

/* Móvil: título primero y acciones en una segunda fila a lo ancho. */
@media (max-width: 767.98px) {
    .app-page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .app-header-actions {
        width: 100%;
    }

    .app-header-actions .btn {
        flex: 1 1 auto;
    }

    .app-page-header h1 {
        font-size: 1.8rem;
    }

    .app-toolbar,
    .app-toolbar .form-control,
    .app-toolbar .form-select,
    .app-toolbar .app-search {
        width: 100%;
        min-width: 0;
    }

    .app-kpi {
        padding: 1rem;
    }

    .app-kpi-value {
        font-size: 1.5rem;
    }

    .app-card,
    .modal-content {
        border-radius: 16px;
    }
}
