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);
    text-wrap: pretty;
}

.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;
}

.tabular-nums {
    font-variant-numeric: tabular-nums;
}

.pedido-estado-badge {
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-wrap: balance;
}

.table-actions--pedidos {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: .35rem;
    min-width: auto;
    white-space: nowrap;
}

.table-actions--pedidos .table-actions__group {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}

.table-actions--pedidos .table-actions__flow:not(:empty) + .table-actions__core {
    padding-left: .35rem;
    border-left: 1px solid var(--app-border);
}

.table-actions--pedidos .table-actions__core + .table-actions__admin {
    padding-left: .35rem;
    border-left: 1px solid var(--app-border);
}

.table-actions--pedidos .table-actions__flow:empty {
    display: none;
}

.table-actions--pedidos .btn {
    position: relative;
    min-width: 2.5rem;
    min-height: 2.5rem;
    padding: .35rem .5rem;
    transition-property: background-color, border-color, color, transform;
    transition-duration: 150ms;
    transition-timing-function: ease-out;
}

.table-actions--pedidos .btn:active:not(:disabled) {
    transform: scale(0.96);
}

.table-actions--pedidos .table-actions__more .dropdown-toggle::after {
    margin-left: 0;
}

.table-actions--pedidos .dropdown-item {
    display: flex;
    align-items: center;
}

.finance-summary--compact {
    margin-top: .25rem;
}

.finance-summary--compact > div {
    padding: .6rem .75rem;
}

.finance-summary strong.tabular-nums,
#PagoTotalResumen,
#PagoSaldoResumen,
#EntregarTotal,
#EntregarSaldo {
    font-variant-numeric: tabular-nums;
}

#mdlPedido .modal-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

.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);
}

/* ===== Sistema visual operativo ===== */
:root {
    --app-bg: #f4f6f9;
    --app-surface: #ffffff;
    --app-surface-muted: #f8fafc;
    --app-border: #d7dee7;
    --app-text: #1f2937;
    --app-text-muted: #64748b;
    --app-primary: #2563a6;
    --app-primary-hover: #174f87;
    --app-primary-soft: #edf5fd;
    --app-success: #177245;
    --app-success-soft: #e8f7ef;
    --app-warning: #92530a;
    --app-warning-soft: #fff4dc;
    --app-danger: #b42318;
    --app-sidebar: #20262e;
    --app-sidebar-border: #343c46;
    --app-radius: .625rem;
    --app-shadow: 0 2px 8px rgba(30, 41, 59, .08);
    --bs-primary: var(--app-primary);
    --bs-primary-rgb: 37, 99, 166;
    --bs-link-color: var(--app-primary);
    --bs-link-hover-color: var(--app-primary-hover);
}

html {
    font-size: 15px;
}

body.app-body {
    margin-bottom: 0;
    color: var(--app-text);
    background: var(--app-bg);
    font-family: "Lato", "Aptos", system-ui, sans-serif;
}

.app-topbar {
    min-height: 58px;
    border-bottom: 1px solid var(--app-border);
    background: var(--app-surface);
}

.app-sidebar-toggle,
.app-topbar-brand {
    color: var(--app-text);
}

.app-topbar-brand {
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
}

.app-sidebar-shell {
    background: var(--app-sidebar);
    border-right: 1px solid var(--app-sidebar-border);
    box-shadow: none;
}

.app-sidebar-shell .sidebar-brand {
    min-height: 58px;
    border-bottom: 1px solid var(--app-sidebar-border);
}

.app-sidebar-shell .brand-link {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .65rem .8rem;
    color: #f2f5f8;
    text-decoration: none;
}

.app-sidebar-shell .brand-image {
    width: 34px;
    height: 34px;
    margin: 0;
    border-radius: .5rem;
    object-fit: cover;
}

.brand-copy {
    display: grid;
    min-width: 0;
    line-height: 1.15;
}

.brand-copy strong {
    overflow: hidden;
    font-size: .9rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-copy span {
    margin-top: .2rem;
    color: #a9b4c0;
    font-size: .72rem;
}

.app-sidebar-shell .sidebar-menu {
    padding: .55rem;
}

.app-sidebar-shell .nav-header {
    padding: 1rem .65rem .4rem;
    color: #8f9ba8;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
}

.app-sidebar-shell .nav-link {
    min-height: 40px;
    margin-bottom: .15rem;
    padding: .55rem .65rem;
    border-radius: .45rem;
    color: #c9d1da;
    transition: color 150ms ease, background-color 150ms ease;
}

.app-sidebar-shell .nav-link:hover,
.app-sidebar-shell .nav-link:focus-visible {
    color: #ffffff;
    background: #2b333d;
}

.app-sidebar-shell .nav-icon {
    width: 1.25rem;
    color: #9eabb8;
    font-size: .95rem;
}

.app-sidebar-shell .nav-link:hover .nav-icon {
    color: #8dc2f0;
}

.app-main {
    background: var(--app-bg);
}

.app-container {
    max-width: 1500px;
}

.app-footer {
    padding: .8rem 1.25rem;
    border-top: 1px solid var(--app-border);
    color: var(--app-text-muted);
    background: var(--app-surface);
    font-size: .82rem;
}

.btn {
    border-radius: .45rem;
    font-weight: 600;
}

.btn-primary {
    border-color: var(--app-primary);
    background: var(--app-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    border-color: var(--app-primary-hover);
    background: var(--app-primary-hover);
}

.btn:focus-visible,
.form-control:focus,
.form-select:focus,
.form-check-input:focus,
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 .2rem rgba(37, 99, 166, .18);
}

.form-control,
.form-select,
.input-group-text {
    min-height: 38px;
    border-color: var(--app-border);
    border-radius: .45rem;
}

.form-label {
    margin-bottom: .35rem;
    color: #344054;
    font-size: .84rem;
    font-weight: 700;
}

.form-text {
    color: var(--app-text-muted);
}

.page-shell {
    gap: 1rem;
}

.page-header {
    padding: 0 0 1rem;
    border: 0;
    border-bottom: 1px solid var(--app-border);
    border-radius: 0;
    background: transparent;
}

.page-kicker,
.modal-kicker {
    color: var(--app-text-muted);
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}

.page-title {
    color: var(--app-text);
    font-size: 1.55rem;
    font-weight: 700;
}

.page-subtitle {
    color: var(--app-text-muted);
}

.app-card,
.card {
    border-color: var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
}

.card-header,
.modal-header,
.modal-footer {
    border-color: var(--app-border);
    background: var(--app-surface);
}

.modal-content {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: 0 8px 24px rgba(30, 41, 59, .14);
}

.app-table {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: #f7f9fc;
    margin-bottom: 0;
}

.app-table th {
    padding: .7rem .75rem;
    border-bottom-color: var(--app-border);
    color: #526071;
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

.app-table td {
    padding: .72rem .75rem;
    border-bottom-color: #e8edf3;
    color: var(--app-text);
}

.app-table tbody tr:last-child td {
    border-bottom: 0;
}

.finance-summary > div,
.security-status > div {
    border-color: var(--app-border);
    border-radius: .5rem;
    background: var(--app-surface-muted);
}

.dashboard-shell {
    display: grid;
    gap: 1rem;
}

.dashboard-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--app-border);
}

.dashboard-header h1 {
    margin: 0;
    color: var(--app-text);
    font-size: 1.55rem;
    font-weight: 700;
}

.dashboard-header p {
    margin: .25rem 0 0;
    color: var(--app-text-muted);
}

.dashboard-actions {
    display: flex;
    gap: .5rem;
}

.workflow-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface);
    box-shadow: var(--app-shadow);
}

.workflow-step {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .7rem;
    min-height: 82px;
    padding: .9rem 1rem;
    border-right: 1px solid var(--app-border);
    color: var(--app-text);
    text-decoration: none;
    transition: background-color 150ms ease;
}

.workflow-step:last-child {
    border-right: 0;
}

.workflow-step:hover,
.workflow-step:focus-visible {
    color: var(--app-text);
    background: var(--app-surface-muted);
}

.workflow-step.is-current {
    background: var(--app-primary-soft);
}

.workflow-step.needs-attention {
    background: var(--app-warning-soft);
}

.workflow-icon {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: .45rem;
    color: var(--app-primary);
    background: var(--app-primary-soft);
}

.needs-attention .workflow-icon {
    color: var(--app-warning);
    background: #ffe8bd;
}

.workflow-copy {
    display: grid;
    min-width: 0;
}

.workflow-copy strong {
    overflow: hidden;
    font-size: .9rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workflow-copy small {
    margin-top: .18rem;
    overflow: hidden;
    color: var(--app-text-muted);
    font-size: .74rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workflow-count {
    min-width: 2rem;
    color: var(--app-text);
    font-size: 1.45rem;
    font-weight: 700;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.dashboard-note {
    margin: 0;
    padding: .65rem .8rem;
    border: 1px solid #f1d49c;
    border-radius: .45rem;
    color: var(--app-warning);
    background: var(--app-warning-soft);
    font-size: .84rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.dashboard-panel {
    min-width: 0;
    overflow: hidden;
}

.dashboard-panel--income {
    grid-column: 1 / -1;
}

.dashboard-panel-header {
    display: flex;
    min-height: 67px;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem 1rem;
}

.dashboard-panel-header h2 {
    margin: 0;
    color: var(--app-text);
    font-size: 1rem;
    font-weight: 700;
}

.dashboard-panel-header p {
    margin: .18rem 0 0;
    color: var(--app-text-muted);
    font-size: .8rem;
}

.dashboard-panel-header a {
    font-size: .82rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.income-total {
    color: var(--app-success);
    font-size: 1.15rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.table-empty {
    padding: 1.5rem;
    color: var(--app-text-muted);
    text-align: center;
}

@media (max-width: 1199.98px) {
    .workflow-board {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .workflow-step:nth-child(2) {
        border-right: 0;
    }

    .workflow-step:nth-child(-n + 2) {
        border-bottom: 1px solid var(--app-border);
    }
}

@media (max-width: 767.98px) {
    .app-container {
        padding: 1rem .75rem !important;
    }

    .app-topbar-brand span {
        display: none;
    }

    .dashboard-header,
    .page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-actions,
    .page-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .dashboard-actions .btn,
    .page-actions .btn,
    .page-header > .btn {
        width: 100%;
    }

    .workflow-board,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .workflow-step,
    .workflow-step:nth-child(2) {
        border-right: 0;
        border-bottom: 1px solid var(--app-border);
    }

    .workflow-step:last-child {
        border-bottom: 0;
    }

    .dashboard-panel--income {
        grid-column: auto;
    }
}

/* ===== Dark mode token overrides ===== */
[data-bs-theme="dark"] {
    color-scheme: dark;
    --app-bg: #0f1117;
    --app-surface: #1a1d27;
    --app-surface-muted: #22263a;
    --app-border: #2d3250;
    --app-text: #e2e8f0;
    --app-text-muted: #8896a5;
    --app-primary: #4a8fd4;
    --app-primary-hover: #3a7bc0;
    --app-primary-soft: #1a2e48;
    --app-success: #36c27d;
    --app-success-soft: #0d2e1e;
    --app-warning: #f0a832;
    --app-warning-soft: #2a1e07;
    --app-danger: #f26b6b;
    --app-sidebar: #101318;
    --app-sidebar-border: #1e2330;
    --app-shadow: 0 2px 8px rgba(0, 0, 0, .40);
    --bs-primary: var(--app-primary);
    --bs-primary-rgb: 74, 143, 212;
    --bs-link-color: var(--app-primary);
    --bs-link-hover-color: var(--app-primary-hover);
    --bs-body-bg: var(--app-bg);
    --bs-body-color: var(--app-text);
    --bs-border-color: var(--app-border);
}

[data-bs-theme="dark"] .app-topbar {
    border-bottom-color: var(--app-border);
    background: var(--app-surface);
}

[data-bs-theme="dark"] .app-table {
    --bs-table-hover-bg: rgba(255,255,255,.04);
}

[data-bs-theme="dark"] .app-table td {
    border-bottom-color: var(--app-border);
}

[data-bs-theme="dark"] .flatpickr-input[readonly] {
    background-color: var(--app-surface);
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .input-group-text {
    background-color: var(--app-surface-muted);
    border-color: var(--app-border);
    color: var(--app-text);
}

[data-bs-theme="dark"] .form-label {
    color: #c4cfd8;
}

[data-bs-theme="dark"] .user-profile-toggle {
    color: var(--app-text);
}

[data-bs-theme="dark"] .user-profile-header strong {
    color: var(--app-text);
}

[data-bs-theme="dark"] .modal-content {
    background: var(--app-surface);
    box-shadow: 0 8px 32px rgba(0, 0, 0, .5);
}

[data-bs-theme="dark"] .receta-preview-wrap .bg-light,
[data-bs-theme="dark"] .bg-body-tertiary {
    background: var(--app-surface-muted) !important;
}

/* Theme selector button group in topbar */
.theme-selector {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    padding: .18rem .28rem;
    border: 1px solid var(--app-border);
    border-radius: .55rem;
    background: var(--app-surface-muted);
}

.theme-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.6rem;
    padding: 0;
    border: 0;
    border-radius: .4rem;
    color: var(--app-text-muted);
    background: transparent;
    cursor: pointer;
    font-size: .82rem;
    transition: background-color 120ms ease, color 120ms ease;
}

.theme-btn:hover {
    color: var(--app-text);
    background: var(--app-border);
}

.theme-btn.active {
    color: var(--app-primary);
    background: var(--app-primary-soft);
}

.theme-btn:focus-visible {
    outline: 2px solid var(--app-primary);
    outline-offset: 2px;
}

