html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}
/***** Ajustes simples *****/
.table td, .table th {
    vertical-align: middle;
}

.app-content .container-fluid {
    min-height: calc(100vh - 160px);
}
/* Select2 + Bootstrap input-group */
.input-group .select2-container {
    flex: 1 1 auto;
    width: 1% !important;
    min-width: 0;
}

.input-group .select2-selection--single {
    height: calc(2.5rem + 2px);
}
/* iguala altura Bootstrap */
.input-group .select2-selection__rendered {
    line-height: 2.5rem;
}

.input-group .select2-selection__arrow {
    height: 2.5rem;
}
/* ---- Form compacto ---- */
.form-condensed .row {
    --bs-gutter-y: .25rem;
}

.form-condensed .form-control,
.form-condensed .form-select,
.form-condensed .input-group-text,
.form-condensed .btn {
    padding: .25rem .5rem;
    font-size: .875rem;
    height: calc(1.8rem + 2px);
}

/* Select2 dentro de input-group y modo peque�o */
.input-group .select2-container {
    flex: 1 1 auto;
    width: 1% !important;
    min-width: 0;
}

.select2-container--bootstrap-5 .select2-selection--single {
    height: calc(1.8rem + 2px);
    padding: .25rem .5rem;
}

.select2-container--bootstrap-5 .select2-selection__rendered {
    line-height: 1.3rem;
}

.select2-container--bootstrap-5 .select2-selection__arrow {
    height: 1.8rem;
}

/* Fila de Elemento en una sola l�nea y compacta */
.el-row {
    display: flex;
    align-items: center;
    gap: 1.0rem;
    flex-wrap: nowrap; /* <= 1 sola l�nea */
    padding: .15rem 0;
}

.el-name {
    min-width: 220px;
    display: flex;
    align-items: center;
    gap: .4rem;
}

.el-lado {
    width: 240px;
}

.el-valor {
    width: 280px;
}
/* input-group de valor */
.el-notas {
    flex: 1 1 auto;
    min-width: 260px;
}
/* ocupa el resto */

/* Compacto (sm) para inputs/selects */
.form-condensed .form-control,
.form-condensed .form-select,
.form-condensed .input-group-text,
.form-condensed .btn {
    padding: .25rem .5rem;
    font-size: .875rem;
    height: calc(1.8rem + 2px);
}

/* Select2 + input-group (ya lo ten�as, lo recuerdo) */
.input-group .select2-container {
    flex: 1 1 auto;
    width: 4% !important;
    min-width: 0;
}

.select2-container--bootstrap-5 .select2-selection--single {
    height: calc(1.8rem + 2px);
    padding: .25rem .5rem;
}

.select2-container--bootstrap-5 .select2-selection__rendered {
    line-height: 1.3rem;
}

.select2-container--bootstrap-5 .select2-selection__arrow {
    height: 1.8rem;
}

/* (Opcional) En pantallas muy peque�as permitir wrap */
@media (max-width: 576px) {
    .el-row {
        flex-wrap: wrap;
    }
}

/* ---- Superficie moderna para m�dulos operativos ---- */
:root {
    --app-surface: #ffffff;
    --app-surface-muted: #f8fafc;
    --app-border: #e5e7eb;
    --app-text-muted: #64748b;
    --app-radius: 1rem;
}

body {
    -webkit-tap-highlight-color: rgba(37, 99, 235, .18);
    touch-action: manipulation;
}

.user-profile-menu {
    display: flex;
    align-items: center;
}

.user-profile-toggle {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .55rem;
    border: 1px solid transparent;
    border-radius: .65rem;
    color: #1f2937;
}

.user-profile-toggle:hover,
.user-profile-toggle:focus {
    border-color: var(--app-border);
    background: var(--app-surface-muted);
    color: #0f172a;
}

.user-profile-avatar {
    display: inline-flex;
    width: 2rem;
    height: 2rem;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #3f3a34;
    color: #fff;
    font-size: .85rem;
    font-weight: 700;
}

.user-profile-name {
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-profile-caret {
    color: var(--app-text-muted);
    font-size: .7rem;
}

.user-profile-dropdown {
    min-width: 17rem;
    padding: .5rem;
    border: 1px solid var(--app-border);
    border-radius: .75rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .10);
}

.user-profile-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .5rem;
}

.user-profile-header strong,
.user-profile-header span {
    display: block;
}

.user-profile-header strong {
    color: #0f172a;
    font-size: .95rem;
}

.user-profile-header span {
    color: var(--app-text-muted);
    font-size: .82rem;
}

.user-profile-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .55rem .6rem;
    border-radius: .5rem;
}

.user-profile-dropdown .dropdown-item i {
    width: 1rem;
    color: #64748b;
    text-align: center;
}

.user-profile-logout {
    margin: 0;
}

.user-profile-logout .dropdown-item {
    width: 100%;
}

.account-shell {
    max-width: 980px;
}

.account-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 1.25rem;
}

.account-nav {
    display: grid;
    align-content: start;
    gap: .25rem;
}

.account-nav a {
    padding: .6rem .7rem;
    border-radius: .5rem;
    color: #334155;
    text-decoration: none;
}

.account-nav a:hover,
.account-nav a.active {
    background: var(--app-surface-muted);
    color: #0f172a;
}

.account-nav a.active {
    font-weight: 700;
}

.account-panel {
    max-width: 620px;
}

.security-status {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;
}

.security-status > div {
    padding: .75rem;
    border: 1px solid var(--app-border);
    border-radius: .75rem;
    background: var(--app-surface-muted);
}

.security-status span,
.security-status strong {
    display: block;
}

.security-status span {
    color: var(--app-text-muted);
    font-size: .82rem;
}

.security-status strong {
    margin-top: .15rem;
    color: #0f172a;
}

.account-steps {
    padding-left: 1.2rem;
    color: #334155;
}

.account-steps li + li {
    margin-top: .35rem;
}

.authenticator-setup {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 1rem;
    align-items: center;
    margin-top: 1rem;
}

.qr-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .75rem;
    border: 1px solid var(--app-border);
    border-radius: .75rem;
    background: #fff;
}

.qr-panel img {
    width: 150px;
    height: 150px;
}

.recovery-code-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
}

.recovery-code-grid code {
    padding: .5rem .65rem;
    border: 1px solid var(--app-border);
    border-radius: .5rem;
    background: var(--app-surface-muted);
    color: #0f172a;
}

.page-shell {
    display: grid;
    gap: 1rem;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: linear-gradient(135deg, #ffffff, #f8fbff);
}

.page-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.page-kicker,
.modal-kicker {
    margin: 0;
    color: var(--app-text-muted);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.page-title {
    margin: 0;
    color: #0f172a;
    font-size: clamp(1.4rem, 1rem + 1.5vw, 2rem);
    font-weight: 750;
    text-wrap: balance;
}

.page-subtitle {
    max-width: 46rem;
    margin: .25rem 0 0;
    color: var(--app-text-muted);
}

.app-card {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: 0 18px 45px rgba(15, 23, 42, .06);
}

.app-table th {
    color: #475569;
    font-size: .75rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.app-table td {
    color: #1f2937;
}

.table-actions {
    min-width: 8.5rem;
    white-space: nowrap;
}

.finance-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;
}

.finance-summary > div {
    padding: .75rem;
    border: 1px solid var(--app-border);
    border-radius: .75rem;
    background: var(--app-surface-muted);
}

.finance-summary span {
    display: block;
    color: var(--app-text-muted);
    font-size: .82rem;
}

.finance-summary strong {
    display: block;
    margin-top: .15rem;
    color: #0f172a;
    font-size: 1rem;
}

.modal-content {
    border: 0;
    border-radius: var(--app-radius);
}

.form-control:focus,
.form-select:focus,
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: #2563eb;
    box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .18);
}

@media (max-width: 768px) {
    .container-fluid.py-3 {
        padding-inline: .75rem;
    }

    .page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .page-header .btn {
        width: 100%;
    }

    .page-actions,
    .finance-summary {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .page-actions {
        display: grid;
    }

    .account-layout,
    .security-status,
    .authenticator-setup,
    .recovery-code-grid {
        grid-template-columns: 1fr;
    }

    .app-card .card-body {
        padding: .75rem;
    }

    .modal-footer {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .modal-footer .btn {
        width: 100%;
    }

    .el-name,
    .el-lado,
    .el-valor,
    .el-notas {
        min-width: 100%;
        width: 100%;
    }
}

.swal2-popup {
    font-family: inherit;
}

.swal2-popup .swal2-actions {
    gap: 0.25rem;
}

.receta-preview-img {
    max-height: 208px;
    max-width: 100%;
    object-fit: contain;
    cursor: zoom-in;
}

.medida-field {
    flex: 1 1 140px;
    max-width: 200px;
}

/* Elementos ortopédicos — tabla dinámica */
.el-lineas-table .el-pie-fields {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.el-lineas-table .el-valor-der,
.el-lineas-table .el-valor-izq {
    width: 4.5rem;
    flex-shrink: 0;
}

.el-lineas-table .el-notas-der,
.el-lineas-table .el-notas-izq {
    flex: 1 1 auto;
    min-width: 0;
}

.el-lineas-table .select2-container {
    min-width: 0;
}

@media (max-width: 768px) {
    .el-lineas-table .el-pie-fields {
        flex-wrap: wrap;
    }
}

.frm-actions {
    position: sticky;
    bottom: 0;
    z-index: 10;
}

input.app-date.form-control {
    min-width: 0;
}

.flatpickr-input[readonly] {
    background-color: var(--bs-body-bg);
}

