/*
 * ARCA - capa visual premium y reversible.
 * Esta hoja solo redefine presentacion. Para volver al estilo base, retire
 * su enlace de app/Views/layouts/main.php; no modifica HTML ni JavaScript.
 */

:root {
    --iu-navy: #003891;
    --iu-ink: #132953;
    --iu-teal: #003891;
    --iu-teal-deep: #003782;
    --iu-sky: #e1f3f7;
    --iu-canvas: #f4f7fb;
    --iu-surface: #ffffff;
    --iu-line: #d9e2e8;
    --iu-muted: #5e6f7f;
    --iu-success: #1e7a4c;
    --iu-warning: #a96009;
    --iu-danger: #ba3b2e;
    --iu-radius: 10px;
    --iu-radius-lg: 16px;
    --iu-shadow: 0 10px 28px rgba(16, 42, 67, 0.07);
    --iu-shadow-raised: 0 18px 40px rgba(16, 42, 67, 0.12);
}

body {
    background:
        radial-gradient(circle at 88% -12%, rgba(25, 158, 184, 0.11), transparent 29rem),
        linear-gradient(180deg, #f8fafb 0%, var(--iu-canvas) 100%);
    color: var(--iu-ink);
}

/* Navegacion: una columna institucional con marcador lateral de seccion. */
.app-frame {
    grid-template-columns: 286px minmax(0, 1fr);
}

.app-sidebar {
    position: relative;
    gap: 24px;
    padding: 24px 14px 28px;
    background:
        radial-gradient(circle at 0 0, rgba(25, 158, 184, 0.18), transparent 18rem),
        linear-gradient(180deg, #003891 0%, #002563 100%);
    box-shadow: inset -1px 0 rgba(255, 255, 255, 0.05);
}

.sidebar-brand {
    padding: 0 10px 18px;
    border-bottom: 1px solid rgba(211, 234, 239, 0.15);
}

.brand-mark {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: linear-gradient(135deg, #74d1df 0%, #d9f1f5 100%);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.sidebar-brand strong {
    font-size: 0.95rem;
    letter-spacing: -0.02em;
}

.sidebar-group {
    gap: 3px;
}

.sidebar-label {
    margin: 12px 10px 7px;
    color: rgba(221, 244, 245, 0.50);
    font-size: 0.67rem;
    font-weight: 800;
    letter-spacing: 0.13em;
}

.sidebar-link {
    position: relative;
    min-height: 46px;
    gap: 11px;
    border-radius: 8px;
    padding: 10px 12px;
    color: rgba(248, 252, 252, 0.85);
    font-size: 0.89rem;
    transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.sidebar-link > i {
    width: 20px;
    color: rgba(197, 230, 234, 0.73);
    font-size: 1rem;
    text-align: center;
}

.sidebar-link small {
    margin-left: auto;
    color: rgba(224, 243, 245, 0.43);
    font-size: 0.68rem;
}

.sidebar-link:hover {
    background: rgba(103, 205, 221, 0.12);
    color: #fff;
    transform: none;
}

.sidebar-link.active {
    background: linear-gradient(90deg, rgba(25, 158, 184, 0.32), rgba(25, 158, 184, 0.12));
    color: #fff;
    font-weight: 700;
}

.sidebar-link.active::before {
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: -14px;
    width: 3px;
    border-radius: 0 4px 4px 0;
    background: #71d4e0;
    content: '';
}

.sidebar-link.active > i {
    color: #8de3ec;
}

.app-navbar {
    min-height: 72px;
    padding: 14px 28px;
    background: rgba(255, 255, 255, 0.92);
    border-bottom-color: var(--iu-line);
    box-shadow: 0 1px 0 rgba(16, 42, 67, 0.02);
}

.navbar-search input {
    height: 40px;
    border-color: var(--iu-line);
    background: #f7fafb;
    color: var(--iu-ink);
    font-size: 0.86rem;
}

.navbar-search input:focus {
    border-color: var(--iu-teal);
    background: #fff;
    box-shadow: 0 0 0 0.22rem rgba(13, 92, 99, 0.12);
}

.navbar-search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--iu-line);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(16, 42, 67, 0.14);
    height: 360px;
    overflow-y: auto;
    padding: 8px 0;
    z-index: 1070;
}

.navbar-search-dropdown.open {
    display: block;
}

.navbar-search-dropdown .ns-group {
    padding: 6px 16px 4px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--iu-muted);
}

.navbar-search-dropdown .ns-item {
    display: flex;
    align-items: start;
    gap: 12px;
    padding: 10px 40px;
    color: var(--iu-ink);
    text-decoration: none;
    cursor: pointer;
    transition: background 120ms ease;
}

.navbar-search-dropdown .ns-item:hover,
.navbar-search-dropdown .ns-item.highlight {
    background: rgba(13, 92, 99, 0.06);
}

.navbar-search-dropdown .ns-item i {
    flex-shrink: 0;
    width: 22px;
    color: var(--iu-teal);
    font-size: 1rem;
    text-align: center;
}

.navbar-search-dropdown .ns-item-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    line-height: 1.35;
}

.navbar-search-dropdown .ns-item-label {
    white-space: nowrap;
}

.navbar-search-dropdown .ns-item-text small {
    font-size: 0.76rem;
    color: var(--iu-muted);
}

.navbar-search-dropdown .ns-item strong {
    font-weight: 700;
    color: var(--iu-teal);
}

.user-chip {
    border-color: var(--iu-line);
    background: #fff;
    color: var(--iu-ink);
    box-shadow: 0 3px 10px rgba(16, 42, 67, 0.04);
}

.user-chip small {
    color: var(--iu-muted);
}

.avatar-circle {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #bceae3, #d7ebf8);
    color: var(--iu-teal-deep);
}

.app-content {
    padding: 32px;
}

.page-header {
    position: relative;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--iu-line);
}

.page-header::after {
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 76px;
    height: 2px;
    background: linear-gradient(90deg, var(--iu-teal), #199eb8);
    content: '';
}

.eyebrow {
    color: var(--iu-teal-deep);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
}

.page-header h1 {
    color: var(--iu-ink);
    font-size: clamp(1.55rem, 2.2vw, 2rem);
    letter-spacing: -0.04em;
}

.page-header p,
.text-muted,
.modal-subtitle {
    color: var(--iu-muted) !important;
}

.app-breadcrumb {
    gap: 2px;
    font-size: 0.79rem;
}

.app-breadcrumb a {
    color: var(--iu-teal-deep);
    font-weight: 700;
}

/* Superficies y bloques de informacion. */
.app-card,
.card.app-card,
.catalog-group-card,
.catalog-group-card + section,
.app-content section.border {
    border: 1px solid var(--iu-line) !important;
    border-radius: var(--iu-radius-lg) !important;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--iu-shadow);
}

.app-card .card-body {
    padding: 26px;
}

.section-title {
    color: var(--iu-ink);
    font-size: 1rem;
    letter-spacing: -0.02em;
}

.kpi-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--iu-line);
    border-radius: var(--iu-radius-lg);
    background: linear-gradient(135deg, #fff 0%, #fbfdfd 100%);
    box-shadow: var(--iu-shadow);
}

.kpi-card::after {
    position: absolute;
    right: -25px;
    bottom: -32px;
    width: 94px;
    height: 94px;
    border: 16px solid rgba(13, 92, 99, 0.06);
    border-radius: 50%;
    content: '';
}

.kpi-card strong {
    color: var(--iu-ink);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.55rem;
    letter-spacing: -0.07em;
}

.kpi-card span {
    color: var(--iu-muted);
    font-weight: 600;
}

.kpi-card i {
    position: relative;
    z-index: 1;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    font-size: 1.3rem;
}

.tone-primary i { background: #e6effd; color: #003891; }
.tone-secondary i { background: #e7eef7; color: #315d91; }
.tone-success i { background: #e5f4eb; color: var(--iu-success); }
.tone-warning i { background: #fff1d9; color: var(--iu-warning); }
.tone-danger i { background: #fbe9e7; color: var(--iu-danger); }
.tone-info i { background: #e5f1fb; color: #23669d; }

/* Acciones, campos y estados: contrastes AA en fondos claros. */
.btn {
    border-radius: 8px;
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.btn:not(.btn-sm):not(.btn-lg) {
    min-height: 40px;
    padding: 0.55rem 0.9rem;
}

.btn-primary {
    border-color: var(--iu-teal);
    background: linear-gradient(135deg, var(--iu-teal) 0%, #199eb8 100%);
    box-shadow: 0 6px 14px rgba(0, 56, 145, 0.20);
}

.btn-primary:hover,
.btn-primary:focus {
    border-color: var(--iu-teal-deep);
    background: var(--iu-teal-deep);
    box-shadow: 0 8px 18px rgba(0, 56, 145, 0.25);
}

.btn-success { background-color: var(--iu-success); border-color: var(--iu-success); }
.btn-warning { background-color: var(--iu-warning); border-color: var(--iu-warning); color: #fff; }
.btn-danger { background-color: var(--iu-danger); border-color: var(--iu-danger); }
.btn-outline-primary { border-color: #4f8589; color: var(--iu-teal-deep); }
.btn-outline-primary:hover { background: var(--iu-teal); border-color: var(--iu-teal); }
.btn-outline-secondary { border-color: #9baab5; color: #3d4e5d; }
.btn-light { border-color: var(--iu-line); background: #f8fafb; color: #314454; }

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

.btn:focus-visible,
.form-control:focus,
.form-select:focus,
.page-link:focus,
.list-group-item:focus-visible,
.sidebar-link:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 0.22rem rgba(0, 56, 145, 0.18) !important;
}

.form-label {
    margin-bottom: 0.42rem;
    color: #334858;
    font-size: 0.8rem;
    font-weight: 800;
}

.form-control,
.form-select {
    min-height: 40px;
    border-color: #cbd8df;
    border-radius: 8px;
    background-color: #fff;
    color: var(--iu-ink);
    font-size: 0.9rem;
}

.form-control::placeholder {
    color: #81909b;
    opacity: 1;
}

.form-control:hover,
.form-select:hover {
    border-color: #94adb9;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--iu-teal);
}

.badge {
    border-radius: 999px;
    padding: 0.38rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.text-bg-success { background-color: var(--iu-success) !important; }
.text-bg-warning { background-color: var(--iu-warning) !important; color: #fff !important; }
.text-bg-danger { background-color: var(--iu-danger) !important; }
.text-success { color: var(--iu-success) !important; }
.text-danger { color: var(--iu-danger) !important; }

/* Tablas: cabecera de registro, filas escaneables y controles coherentes. */
.table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: #f7fafb;
    --bs-table-hover-bg: #eef7f7;
    --bs-table-border-color: #e0e8ec;
    color: #273b4b;
    font-size: 0.86rem;
}

.table > :not(caption) > * > * {
    padding: 0.82rem 0.75rem;
    vertical-align: middle;
}

.table > thead > tr > th {
    border-top: 0;
    border-bottom: 1px solid #cddae0;
    background: #edf4f6;
    color: #385363;
    font-size: 0.69rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    white-space: nowrap;
}

.table-hover > tbody > tr {
    transition: background-color 120ms ease;
}

.dataTables_wrapper .dt-layout-row {
    align-items: center;
    gap: 12px;
}

.dataTables_wrapper .dt-layout-cell {
    padding: 0 0 14px;
}

.dataTables_wrapper .dt-search input,
.dataTables_wrapper .dt-input {
    min-height: 38px;
    margin-left: 7px;
    border: 1px solid #cbd8df;
    border-radius: 8px;
    background: #fff;
    color: var(--iu-ink);
}

.dataTables_wrapper .dt-search input:focus,
.dataTables_wrapper .dt-input:focus {
    border-color: var(--iu-teal);
    box-shadow: 0 0 0 0.22rem rgba(0, 56, 145, 0.12);
}

.dataTables_wrapper .dt-info,
.dataTables_wrapper .dt-search label,
.dataTables_wrapper .dt-length label {
    color: var(--iu-muted);
    font-size: 0.8rem;
}

.dataTables_wrapper .dt-paging .dt-paging-button,
.pagination .page-link {
    min-width: 34px;
    border: 1px solid var(--iu-line);
    border-radius: 7px !important;
    background: #fff;
    color: #3e5565;
    font-weight: 700;
}

.dataTables_wrapper .dt-paging .dt-paging-button:hover,
.pagination .page-item:not(.active) .page-link:hover {
    border-color: #8db7ba;
    background: #eaf5f4;
    color: var(--iu-teal-deep);
}

.dataTables_wrapper .dt-paging .dt-paging-button.current,
.pagination .page-item.active .page-link {
    border-color: var(--iu-teal) !important;
    background: var(--iu-teal) !important;
    color: #fff !important;
}

.btn-premium-export,
div.dt-buttons .btn-premium-export {
    border-radius: 8px;
    background: linear-gradient(135deg, #003891 0%, #199eb8 100%);
    box-shadow: 0 8px 18px rgba(0, 56, 145, 0.20);
}

/* Paneles secundarios y ventanas modales. */
.list-group-item {
    border-color: #e1e9ed;
    color: #334858;
    transition: background-color 130ms ease, color 130ms ease;
}

.list-group-item:hover,
.list-group-item.active {
    border-color: #b9d8d9;
    background: #edf8f7;
    color: var(--iu-teal-deep);
}

.catalog-group-card {
    background: #fbfcfc;
    box-shadow: none;
}

.modal-content,
.dropdown-menu {
    border: 1px solid var(--iu-line);
    border-radius: 14px;
    box-shadow: var(--iu-shadow-raised);
}

.modal-header,
.modal-footer {
    border-color: #e2e9ed;
}

.modal-header {
    padding: 1.1rem 1.35rem;
    background: linear-gradient(180deg, #fbfdfd, #f5f9fa);
}

.modal-body { padding: 1.35rem; }
.modal-footer { padding: 1rem 1.35rem; background: #fbfcfc; }
.modal-title { color: var(--iu-ink); font-weight: 800; letter-spacing: -0.02em; }

.table-actions {
    display: inline-flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
}

.table-actions .btn {
    white-space: nowrap;
}

.detail-loading {
    display: grid;
    min-height: 180px;
    place-items: center;
    color: var(--iu-muted);
}

.detail-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
    padding: 18px;
    border: 1px solid #dbe8ed;
    border-radius: 12px;
    background: linear-gradient(135deg, #f4f9fb 0%, #eef7f8 100%);
}

.detail-hero strong,
.detail-hero small,
.detail-label {
    display: block;
}

.detail-hero strong {
    color: var(--iu-ink);
    font-size: 1.2rem;
    letter-spacing: -0.03em;
}

.detail-hero small {
    margin-top: 4px;
    color: var(--iu-muted);
}

.detail-label,
.detail-field span,
.detail-section-title {
    color: var(--iu-teal-deep);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    margin-bottom: 22px;
    border: 1px solid #e0e8ec;
    border-radius: 10px;
    background: #e0e8ec;
}

.detail-field {
    min-width: 0;
    padding: 13px 15px;
    background: #fff;
}

.detail-field strong {
    display: block;
    overflow: hidden;
    margin-top: 5px;
    color: #2e4555;
    font-size: 0.88rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-section {
    margin-top: 18px;
}

.detail-section-title {
    display: block;
    margin-bottom: 9px;
}

.detail-table {
    margin-bottom: 0;
    border: 1px solid #e0e8ec;
    border-radius: 8px;
    overflow: hidden;
}

@media (max-width: 575.98px) {
    .detail-grid { grid-template-columns: 1fr; }
    .detail-hero { flex-direction: column; }
    .table-actions .btn span { display: none; }
    .table-actions .btn { padding-inline: 0.55rem; }
}

.dropdown-menu {
    padding: 0.45rem;
    font-size: 0.86rem;
}

.dropdown-item {
    border-radius: 7px;
    padding: 0.56rem 0.7rem;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: #eaf5f4;
    color: var(--iu-teal-deep);
}

.alert {
    border-width: 1px;
    border-radius: 10px;
}

.app-footer {
    border-top: 1px solid rgba(217, 226, 232, 0.72);
    color: var(--iu-muted);
}

/* Acceso: una portada sobria que prioriza identificacion y continuidad. */
.login-page {
    position: relative;
    overflow-x: hidden;
    padding: 32px 20px;
    background:
        radial-gradient(circle at 14% 10%, rgba(25, 158, 184, 0.18), transparent 26rem),
        radial-gradient(circle at 93% 90%, rgba(0, 56, 145, 0.13), transparent 24rem),
        #edf3f5;
}

.login-page::before,
.login-page::after {
    position: fixed;
    z-index: -1;
    width: min(34vw, 440px);
    aspect-ratio: 1;
    border: 1px solid rgba(0, 56, 145, 0.08);
    border-radius: 50%;
    content: '';
}

.login-page::before { top: -15vw; left: -12vw; }
.login-page::after { right: -15vw; bottom: -20vw; }

.login-shell {
    width: min(1050px, 100%);
    grid-template-columns: minmax(0, 1.15fr) minmax(350px, 0.85fr);
    gap: 18px;
    align-items: stretch;
}

.login-showcase {
    position: relative;
    overflow: hidden;
    min-height: 580px;
    padding: clamp(32px, 5vw, 56px);
    border: 1px solid rgba(130, 218, 233, 0.24);
    border-radius: 18px;
    background:
        linear-gradient(120deg, rgba(0, 56, 145, 0.84), rgba(0, 37, 99, 0.97)),
        linear-gradient(135deg, #199eb8, #003891);
    box-shadow: 0 22px 50px rgba(0, 40, 105, 0.22);
}

.login-showcase::after {
    position: absolute;
    right: -100px;
    bottom: -118px;
    width: 330px;
    height: 330px;
    border: 44px solid rgba(120, 220, 235, 0.12);
    border-radius: 50%;
    content: '';
}

.login-showcase .eyebrow {
    position: relative;
    z-index: 1;
    color: #aeeaf2;
}

.login-showcase h1 {
    position: relative;
    z-index: 1;
    max-width: 590px;
    font-size: clamp(2.15rem, 4vw, 3.45rem);
    letter-spacing: -0.06em;
}

.login-showcase > p {
    position: relative;
    z-index: 1;
    max-width: 510px;
    color: rgba(241, 252, 252, 0.78);
    font-size: 0.98rem;
    line-height: 1.65;
}

.login-metrics {
    position: relative;
    z-index: 1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: auto;
    padding-top: 48px;
}

.login-metrics article {
    min-height: 132px;
    border-color: rgba(196, 239, 235, 0.16);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.055);
    padding: 15px;
}

.login-metrics strong {
    color: #edfffb;
    font-size: 0.8rem;
    line-height: 1.25;
}

.login-metrics span {
    margin-top: 8px;
    color: rgba(228, 248, 247, 0.68);
    font-size: 0.73rem;
    line-height: 1.45;
}

.login-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid rgba(207, 221, 227, 0.92);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 22px 50px rgba(16, 42, 67, 0.11);
    padding: clamp(28px, 4vw, 46px);
}

.login-card-header h2 {
    color: var(--iu-ink);
    font-size: 1.7rem;
    letter-spacing: -0.045em;
}

.login-card-header p {
    margin-top: 8px;
    color: var(--iu-muted);
    font-size: 0.88rem;
}

.login-form {
    margin-top: 30px;
}

.login-form .form-label {
    font-size: 0.78rem;
}

.login-form .form-control {
    min-height: 46px;
}

.login-form .btn-primary {
    min-height: 46px;
    margin-top: 8px;
}

.login-hint {
    margin-top: 26px;
    padding: 14px 15px;
    border: 1px solid #d9e6e9;
    border-radius: 9px;
    background: #f4f9f9;
    color: #415968;
    font-size: 0.78rem;
    line-height: 1.6;
}

@media (max-width: 991.98px) {
    .login-page { align-items: flex-start; }
    .login-shell { grid-template-columns: 1fr; max-width: 620px; }
    .login-showcase { min-height: auto; }
    .login-metrics { margin-top: 0; padding-top: 30px; }
}

@media (max-width: 575.98px) {
    .login-page { padding: 16px; }
    .login-showcase { padding: 30px 24px; }
    .login-showcase h1 { font-size: 2rem; }
    .login-metrics { grid-template-columns: 1fr; }
    .login-metrics article { min-height: auto; }
    .login-card { padding: 28px 22px; }
}

@media (max-width: 991.98px) {
    .app-content { padding: 24px; }
    .app-navbar { padding: 12px 18px; }
    .offcanvas .app-sidebar { min-height: 100%; }
}

@media (max-width: 767.98px) {
    .app-content { padding: 20px 16px; }
    .page-header { align-items: flex-start; margin-bottom: 20px; }
    .page-header-actions { width: 100%; }
    .page-header-actions .btn { width: 100%; }
    .app-card .card-body { padding: 18px; }
    .table > :not(caption) > * > * { padding: 0.7rem 0.62rem; }
    .dataTables_wrapper .dt-layout-row { align-items: stretch; }
    .dataTables_wrapper .dt-search input { width: min(100%, 240px); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
