/*
 * TodoTerapia - Pulido visual global de usabilidad
 * Cambios visuales: navegación, espaciado, tarjetas, tablas, formularios,
 * botones y comportamiento responsivo. No agrega permisos ni lógica clínica.
 */
:root {
    --tt-primary: #0f3d66;
    --tt-primary-2: #1d5d93;
    --tt-primary-3: #eaf4ff;
    --tt-accent: #45c7c3;
    --tt-bg: #f4f7fb;
    --tt-surface: #ffffff;
    --tt-muted: #64748b;
    --tt-text: #102033;
    --tt-border: rgba(15, 61, 102, .12);
    --tt-shadow: 0 18px 45px rgba(15, 61, 102, .08);
    --tt-shadow-soft: 0 10px 25px rgba(15, 61, 102, .06);
    --tt-radius: 20px;
    --tt-sidebar-width: 316px;
    --tt-topbar-height: 74px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
    min-height: 100vh;
    margin: 0;
    color: var(--tt-text);
    background:
        radial-gradient(circle at top left, rgba(69, 199, 195, .16), transparent 34rem),
        linear-gradient(180deg, #f8fbff 0%, var(--tt-bg) 100%);
    font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { text-decoration: none; }
a:hover { text-decoration: none; }

.tt-app-shell {
    min-height: 100vh;
    display: flex;
    width: 100%;
}

.tt-menu-toggle { display: none; }

.tt-sidebar {
    position: sticky;
    top: 0;
    width: var(--tt-sidebar-width);
    min-width: var(--tt-sidebar-width);
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 18px 16px;
    overflow-x: hidden;
    color: #fff;
    background:
        linear-gradient(160deg, rgba(15, 61, 102, .98), rgba(13, 47, 80, .98)),
        radial-gradient(circle at top right, rgba(69,199,195,.35), transparent 18rem);
    box-shadow: 18px 0 45px rgba(15, 61, 102, .12);
    z-index: 1040;
}

.tt-sidebar-brand {
    margin-bottom: 16px;
    width: 100%;
    min-width: 0;
}
.tt-brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
    color: #fff;
}
.tt-brand-link:hover { color: #fff; }
.tt-brand-mark {
    width: 46px;
    height: 46px;
    min-width: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--tt-accent), #7dd3fc);
    color: #08324f;
    font-weight: 800;
    letter-spacing: -.03em;
    box-shadow: 0 12px 28px rgba(69, 199, 195, .24);
}
.tt-brand-title,
.tt-brand-subtitle { display: block; line-height: 1.1; }
.tt-brand-title { font-size: 1.12rem; font-weight: 800; letter-spacing: -.02em; }
.tt-brand-subtitle { margin-top: 4px; font-size: .78rem; color: rgba(255,255,255,.72); }

.tt-sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
    gap: 5px;
    width: 100%;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 2px;
}
.tt-sidebar-nav::-webkit-scrollbar { width: 6px; }
.tt-sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.22); border-radius: 999px; }

.tt-nav-section {
    margin: 12px 8px 5px;
    color: rgba(255,255,255,.54);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 700;
}
.tt-nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 9px 12px;
    border-radius: 15px;
    color: rgba(255,255,255,.86);
    font-weight: 650;
    line-height: 1.15;
    overflow: hidden;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}
.tt-nav-link:hover,
.tt-nav-link.active {
    color: #fff;
    background: rgba(255,255,255,.13);
}
.tt-nav-link:hover { transform: translateX(2px); }
.tt-nav-link.active {
    box-shadow: inset 3px 0 0 var(--tt-accent);
}
.tt-nav-icon {
    width: 23px;
    min-width: 23px;
    flex: 0 0 23px;
    text-align: center;
    opacity: .94;
}
.tt-nav-link > span {
    min-width: 0;
    flex: 1 1 auto;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tt-nav-link .badge,
.tt-nav-link .tt-nav-badge {
    flex: 0 0 auto;
    margin-left: auto;
}

.tt-sidebar-user {
    flex: 0 0 auto;
    margin-top: 12px;
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 18px;
    background: rgba(255,255,255,.08);
}
.tt-user-avatar {
    width: 38px;
    height: 38px;
    min-width: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff;
    color: var(--tt-primary);
    font-weight: 800;
}
.tt-user-info { min-width: 0; flex: 1 1 auto; }
.tt-user-name,
.tt-user-email {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tt-user-name { font-size: .9rem; font-weight: 750; }
.tt-user-email { font-size: .74rem; color: rgba(255,255,255,.68); }

.tt-main-area {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.tt-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    min-height: var(--tt-topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 28px;
    background: rgba(248, 251, 255, .86);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--tt-border);
}
.tt-topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
.tt-topbar-title {
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.1;
}
.tt-topbar-subtitle {
    margin-top: 2px;
    color: var(--tt-muted);
    font-size: .82rem;
}
.tt-menu-button {
    display: none;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--tt-border);
    border-radius: 14px;
    background: #fff;
    color: var(--tt-primary);
    cursor: pointer;
}
.tt-topbar-btn {
    border: 1px solid var(--tt-border);
    border-radius: 999px;
    font-weight: 700;
}
.tt-content {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 28px;
}

/* Compatibilidad con clases existentes */
.sidebar { background: var(--tt-primary); }
.brand-box {
    background: linear-gradient(135deg, var(--tt-primary) 0%, var(--tt-primary-2) 100%);
    color: #fff;
    border-radius: var(--tt-radius);
}
.card,
.card-soft {
    border: 1px solid var(--tt-border) !important;
    border-radius: var(--tt-radius) !important;
    box-shadow: var(--tt-shadow-soft);
    background: var(--tt-surface);
}
.card-soft { box-shadow: var(--tt-shadow); }
.card-header {
    border-bottom: 1px solid var(--tt-border);
    background: linear-gradient(180deg, #fff, #fbfdff);
    border-top-left-radius: var(--tt-radius) !important;
    border-top-right-radius: var(--tt-radius) !important;
}
.card-body { padding: 1.35rem; }

.module-card {
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.module-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 42px rgba(15,61,102,.13);
    border-color: rgba(69,199,195,.45) !important;
}
.module-card .module-icon,
.module-icon {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--tt-primary-3), #f4fffe);
    color: var(--tt-primary);
    font-size: 25px;
}

h1, h2, h3, h4, h5, h6 { color: #0e253d; letter-spacing: -.02em; }
.text-muted { color: var(--tt-muted) !important; }

.btn {
    border-radius: 12px;
    font-weight: 700;
    box-shadow: none !important;
}
.btn-primary {
    background: linear-gradient(135deg, var(--tt-primary), var(--tt-primary-2));
    border-color: var(--tt-primary);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-outline-primary {
    color: var(--tt-primary);
    border-color: rgba(15,61,102,.35);
}
.btn-outline-primary:hover {
    color: #fff;
    background: var(--tt-primary);
    border-color: var(--tt-primary);
}
.btn-danger { border-radius: 12px; }

.badge {
    border-radius: 999px;
    padding: .45rem .65rem;
    font-weight: 750;
}
.alert {
    border: 0;
    border-radius: 18px;
    box-shadow: var(--tt-shadow-soft);
}

.form-control,
.form-select {
    border-radius: 13px;
    border-color: rgba(15,61,102,.16);
    min-height: 42px;
}
.form-control:focus,
.form-select:focus {
    border-color: rgba(69,199,195,.85);
    box-shadow: 0 0 0 .22rem rgba(69,199,195,.14);
}
label.form-label { font-weight: 700; color: #334155; }

.table {
    --bs-table-bg: transparent;
    vertical-align: middle;
}
.table thead th {
    color: #334155;
    background: #f8fbff;
    border-bottom: 1px solid var(--tt-border);
    font-size: .84rem;
    text-transform: none;
}
.table tbody td { border-color: rgba(15,61,102,.08); }
.table-responsive {
    border-radius: 18px;
    border: 1px solid var(--tt-border);
    background: #fff;
}

.list-group-item { border-color: rgba(15,61,102,.08); }
.dropdown-menu {
    border: 1px solid var(--tt-border);
    border-radius: 16px;
    box-shadow: var(--tt-shadow);
}

.login-wrap { min-height: 100vh; }


/* Iteración UI 2.1: corrección fina del sidebar */
.tt-sidebar,
.tt-sidebar * {
    backface-visibility: hidden;
}
.tt-sidebar {
    flex: 0 0 var(--tt-sidebar-width);
    background:
        linear-gradient(160deg, #0f3d66 0%, #123f68 48%, #0d2f50 100%),
        radial-gradient(circle at top right, rgba(69,199,195,.28), transparent 18rem);
}
.tt-main-area {
    width: calc(100% - var(--tt-sidebar-width));
}
.tt-brand-link > span:last-child {
    min-width: 0;
    overflow: hidden;
}
.tt-brand-title,
.tt-brand-subtitle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@media (min-width: 992px) and (max-width: 1180px) {
    :root { --tt-sidebar-width: 304px; }
    .tt-sidebar { padding-left: 14px; padding-right: 14px; }
    .tt-nav-link { padding-left: 10px; padding-right: 10px; gap: 10px; }
}

@media (max-width: 991.98px) {
    .tt-app-shell { display: block; }
    .tt-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-104%);
        transition: transform .22s ease;
        width: min(92vw, var(--tt-sidebar-width));
        max-width: min(92vw, var(--tt-sidebar-width));
    }
    .tt-menu-toggle:checked ~ .tt-sidebar { transform: translateX(0); }
    .tt-sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(2, 12, 27, .42);
        z-index: 1030;
    }
    .tt-menu-toggle:checked ~ .tt-sidebar-backdrop { display: block; }
    .tt-main-area { min-height: 100vh; width: 100%; }
    .tt-menu-button { display: inline-flex; }
    .tt-topbar {
        padding: 12px 16px;
        min-height: 66px;
    }
    .tt-topbar-actions { display: none; }
    .tt-content { padding: 18px 14px 28px; }
    .card-body { padding: 1rem; }
}

@media (max-width: 575.98px) {
    .tt-topbar-title { font-size: .98rem; }
    .tt-topbar-subtitle { display: none; }
    .tt-content { padding-left: 12px; padding-right: 12px; }
    .display-6 { font-size: 2rem; }
    .btn { width: auto; }
    .d-flex.gap-2.flex-wrap .btn { margin-bottom: 2px; }
}

/* Iteración UI 2: dashboard principal y entrada de Psicología */
.tt-page-hero {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px;
    padding: 28px;
    border-radius: 28px;
    color: #fff;
    background:
        radial-gradient(circle at 82% 12%, rgba(125, 211, 252, .34), transparent 20rem),
        radial-gradient(circle at 12% 0%, rgba(69, 199, 195, .30), transparent 22rem),
        linear-gradient(135deg, #0f3d66 0%, #174d7c 48%, #0c314f 100%);
    box-shadow: 0 24px 58px rgba(15, 61, 102, .18);
}
.tt-page-hero h1 {
    margin: .25rem 0 .5rem;
    color: #fff;
    font-size: clamp(2rem, 4vw, 3.25rem);
    font-weight: 850;
    letter-spacing: -.04em;
}
.tt-page-hero p {
    max-width: 760px;
    margin: 0;
    color: rgba(255,255,255,.82);
    font-size: 1.02rem;
}
.tt-page-hero .tt-eyebrow { color: rgba(255,255,255,.70); }
.tt-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}
.tt-page-hero__aside {
    display: grid;
    gap: 12px;
    align-content: center;
}
.tt-mini-card {
    padding: 16px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 20px;
    background: rgba(255,255,255,.10);
    backdrop-filter: blur(10px);
}
.tt-mini-card span,
.tt-mini-card small,
.tt-mini-card strong { display: block; }
.tt-mini-card span { color: rgba(255,255,255,.70); font-size: .78rem; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.tt-mini-card strong { margin-top: 4px; color: #fff; font-size: 1.1rem; }
.tt-mini-card small { margin-top: 3px; color: rgba(255,255,255,.70); }
.tt-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--tt-primary-2);
    font-size: .76rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.tt-stat-card {
    min-height: 118px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--tt-border);
    border-radius: 22px;
    background: #fff;
    box-shadow: var(--tt-shadow-soft);
}
.tt-stat-icon {
    width: 54px;
    height: 54px;
    min-width: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    color: var(--tt-primary);
    background: linear-gradient(135deg, #eaf4ff, #edfffd);
    font-size: 1.25rem;
}
.tt-stat-card span,
.tt-stat-card small { display: block; }
.tt-stat-card span { color: var(--tt-muted); font-weight: 750; font-size: .84rem; }
.tt-stat-card strong {
    display: block;
    margin: 2px 0;
    color: #0e253d;
    font-size: 2rem;
    line-height: 1;
    letter-spacing: -.04em;
}
.tt-stat-card .tt-stat-text { font-size: 1.35rem; line-height: 1.15; }
.tt-stat-card small { color: var(--tt-muted); font-size: .8rem; }
.tt-section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}
.tt-section-heading h2 {
    margin: 3px 0 2px;
    font-size: 1.35rem;
    font-weight: 820;
}
.tt-section-heading p { margin: 0; color: var(--tt-muted); }
.tt-section-heading.compact { margin-bottom: 14px; }
.tt-module-tile {
    height: 100%;
    display: flex;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--tt-border);
    border-radius: 22px;
    background: linear-gradient(180deg, #fff 0%, #fbfdff 100%);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.tt-module-tile:hover {
    transform: translateY(-3px);
    box-shadow: var(--tt-shadow);
    border-color: rgba(69,199,195,.48);
}
.tt-module-tile.is-disabled { opacity: .74; }
.tt-module-tile__icon {
    width: 52px;
    height: 52px;
    min-width: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 17px;
    color: var(--tt-primary);
    background: var(--tt-primary-3);
    font-size: 1.35rem;
}
.tt-module-tile__body { min-width: 0; flex: 1; }
.tt-module-tile h3 { margin: 0 0 6px; font-size: 1rem; font-weight: 820; }
.tt-module-tile p { margin: 0; color: var(--tt-muted); font-size: .9rem; }
.tt-module-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tt-module-meta span {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    color: #475569;
    background: #f6f9fd;
    font-size: .73rem;
    font-weight: 700;
}
.tt-plan-box {
    display: grid;
    gap: 10px;
}
.tt-plan-box > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(15,61,102,.08);
}
.tt-plan-box > div:last-child { border-bottom: 0; }
.tt-plan-box span { color: var(--tt-muted); font-weight: 700; }
.tt-plan-box strong { text-align: right; }
.tt-alert-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.tt-alert-action strong,
.tt-alert-action span { display: block; }
.tt-activity-list { display: grid; gap: 14px; }
.tt-activity-item { display: flex; gap: 10px; }
.tt-activity-dot {
    width: 12px;
    height: 12px;
    min-width: 12px;
    margin-top: 6px;
    border-radius: 999px;
}
.tt-activity-item strong { display: block; font-size: .92rem; }
.tt-activity-item p { margin: 2px 0; color: var(--tt-muted); font-size: .84rem; }
.tt-activity-item small { color: var(--tt-muted); }
.tt-empty-state {
    display: grid;
    place-items: center;
    text-align: center;
    gap: 8px;
    min-height: 220px;
    padding: 28px;
    color: var(--tt-muted);
    border: 1px dashed rgba(15,61,102,.18);
    border-radius: 22px;
    background: #fbfdff;
}
.tt-empty-state i { color: var(--tt-primary-2); font-size: 2rem; }
.tt-empty-state strong { color: #0e253d; }
.tt-empty-state.small-state { min-height: 160px; }
.tt-specialty-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px;
    border: 1px solid var(--tt-border);
    border-radius: 24px;
    background: #fff;
    box-shadow: var(--tt-shadow-soft);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.tt-specialty-card:hover {
    color: inherit;
    transform: translateY(-4px);
    box-shadow: var(--tt-shadow);
    border-color: rgba(69,199,195,.48);
}
.tt-specialty-icon {
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    font-size: 1.2rem;
}
.tt-specialty-card h3 { margin: 4px 0 0; font-size: 1.05rem; font-weight: 820; }
.tt-specialty-card p { flex: 1; margin: 0; color: var(--tt-muted); font-size: .9rem; }
.tt-card-action { color: var(--tt-primary); font-weight: 800; }
.tt-step-list { display: grid; gap: 14px; }
.tt-step { display: flex; gap: 14px; align-items: flex-start; }
.tt-step > span {
    width: 34px;
    height: 34px;
    min-width: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: var(--tt-primary);
    background: var(--tt-primary-3);
    font-weight: 850;
}
.tt-step strong { display: block; color: #0e253d; }
.tt-step p { margin: 2px 0 0; color: var(--tt-muted); }
.tt-quick-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.tt-quick-grid a {
    min-height: 96px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    border: 1px solid var(--tt-border);
    border-radius: 20px;
    color: #0e253d;
    background: #fbfdff;
    font-weight: 800;
}
.tt-quick-grid a:hover { background: var(--tt-primary-3); color: var(--tt-primary); }
.tt-quick-grid i { color: var(--tt-primary); }

@media (max-width: 1199.98px) {
    .tt-page-hero { grid-template-columns: 1fr; }
    .tt-page-hero__aside { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767.98px) {
    .tt-page-hero { padding: 22px; border-radius: 24px; }
    .tt-page-hero__aside { grid-template-columns: 1fr; }
    .tt-section-heading { flex-direction: column; align-items: stretch; }
    .tt-alert-action { flex-direction: column; align-items: stretch; }
    .tt-module-tile { flex-direction: column; }
    .tt-quick-grid { grid-template-columns: 1fr; }
}


/* Iteración UI 2.8 - Ajuste de espacio solicitado
   Objetivo: mantener el menú utilizable sin esconder herramientas.
   - Oculta el rótulo "Administración" para ganar altura.
   - Reduce la tarjeta del usuario inferior.
   - Ajusta espacios del sidebar sin compactar exageradamente.
   - El panel grande del dashboard se eliminó desde la vista. */
.tt-sidebar {
    padding: 14px 12px;
}

.tt-sidebar-brand {
    margin-bottom: 10px;
}

.tt-brand-link {
    gap: 10px;
}

.tt-brand-mark {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 14px;
    font-size: .95rem;
}

.tt-brand-title {
    font-size: 1rem;
}

.tt-brand-subtitle {
    margin-top: 2px;
    font-size: .72rem;
}

.tt-sidebar-nav {
    gap: 4px;
    padding-right: 1px;
}

.tt-nav-section {
    display: none !important;
}

.tt-nav-link {
    min-height: 39px;
    padding: 8px 10px;
    border-radius: 13px;
    gap: 10px;
}

.tt-nav-icon {
    width: 19px;
    min-width: 19px;
    font-size: .98rem;
}

.tt-sidebar-user {
    margin-top: 8px;
    padding: 7px 8px;
    gap: 8px;
    border-radius: 14px;
    background: rgba(255,255,255,.075);
}

.tt-user-avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: .78rem;
}

.tt-user-name {
    font-size: .78rem;
    line-height: 1.05;
}

.tt-user-email {
    margin-top: 2px;
    font-size: .64rem;
    line-height: 1.05;
}

.tt-content {
    padding-top: 20px;
}

.tt-topbar {
    min-height: 62px;
}

.tt-stat-card {
    min-height: 118px;
}

/* Iteración UI 2.9 - Dashboard proporcionado
   Corrige la desproporción visual del contenido del dashboard después de quitar el panel grande.
   No agrega funcionalidad: solo ajusta tamaños, espacios y balance de las tarjetas. */
.tt-dashboard-balanced {
    max-width: 1180px;
    margin: 0 auto;
}

.tt-dashboard-balanced .tt-dashboard-metrics {
    align-items: stretch;
    margin-bottom: 22px !important;
}

.tt-dashboard-balanced .tt-stat-card {
    min-height: 96px;
    padding: 16px 18px;
    gap: 14px;
    border-radius: 20px;
}

.tt-dashboard-balanced .tt-stat-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 16px;
    font-size: 1.08rem;
}

.tt-dashboard-balanced .tt-stat-card span {
    font-size: .8rem;
    line-height: 1.15;
}

.tt-dashboard-balanced .tt-stat-card strong {
    margin: 3px 0;
    font-size: 1.7rem;
    line-height: 1;
}

.tt-dashboard-balanced .tt-stat-card .tt-stat-text {
    font-size: 1.12rem;
    line-height: 1.18;
}

.tt-dashboard-balanced .tt-stat-card small {
    font-size: .76rem;
    line-height: 1.25;
}

.tt-dashboard-balanced .row.g-4 {
    --bs-gutter-x: 1.25rem;
    --bs-gutter-y: 1.25rem;
}

.tt-dashboard-balanced .card-soft {
    border-radius: 22px !important;
    box-shadow: 0 12px 30px rgba(15, 61, 102, .07);
}

.tt-dashboard-balanced .card-body {
    padding: 1.15rem;
}

.tt-dashboard-balanced .tt-section-heading {
    margin-bottom: 14px;
}

.tt-dashboard-balanced .tt-section-heading h2 {
    font-size: 1.18rem;
    margin-top: 2px;
}

.tt-dashboard-balanced .tt-section-heading p {
    max-width: 620px;
    font-size: .9rem;
    line-height: 1.45;
}

.tt-dashboard-balanced .tt-eyebrow {
    font-size: .7rem;
    letter-spacing: .075em;
}

.tt-dashboard-balanced .tt-module-tile {
    padding: 14px;
    gap: 12px;
    border-radius: 20px;
}

.tt-dashboard-balanced .tt-module-tile__icon {
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: 15px;
    font-size: 1.15rem;
}

.tt-dashboard-balanced .tt-module-tile h3 {
    font-size: .96rem;
    margin-bottom: 5px;
}

.tt-dashboard-balanced .tt-module-tile p {
    font-size: .82rem;
    line-height: 1.42;
}

.tt-dashboard-balanced .tt-module-meta {
    margin-top: 8px;
}

.tt-dashboard-balanced .tt-module-meta span {
    padding: 3px 7px;
    font-size: .68rem;
}

.tt-dashboard-balanced .tt-plan-box {
    gap: 6px;
}

.tt-dashboard-balanced .tt-plan-box > div {
    padding: 9px 0;
}

.tt-dashboard-balanced .tt-plan-box span,
.tt-dashboard-balanced .tt-plan-box strong {
    font-size: .88rem;
}

.tt-dashboard-balanced .d-grid.gap-2.mt-3 {
    margin-top: .75rem !important;
}

.tt-dashboard-balanced .btn {
    min-height: 36px;
    padding: .45rem .75rem;
    font-size: .86rem;
}

.tt-dashboard-balanced .tt-empty-state.small-state {
    min-height: 120px;
}

@media (min-width: 1200px) {
    .tt-dashboard-balanced .col-xl-8 {
        flex: 0 0 auto;
        width: 68%;
    }
    .tt-dashboard-balanced .col-xl-4 {
        flex: 0 0 auto;
        width: 32%;
    }
}

@media (max-width: 991.98px) {
    .tt-dashboard-balanced {
        max-width: 100%;
    }
    .tt-dashboard-balanced .tt-stat-card {
        min-height: 92px;
    }
}

/* Iteración UI 3 - Pacientes y Agenda
   Objetivo: mejorar la lectura y el flujo operativo de las pantallas de Pacientes y Agenda
   sin cambiar rutas, permisos, formularios, controladores ni base de datos. */
.tt-page-panel {
    max-width: 1240px;
    margin: 0 auto;
}

.tt-page-panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
    padding: 20px 22px;
    border: 1px solid var(--tt-border);
    border-radius: 24px;
    background: rgba(255,255,255,.86);
    box-shadow: 0 12px 30px rgba(15, 61, 102, .06);
}

.tt-page-panel__header h1 {
    margin: 5px 0 4px;
    font-size: clamp(1.55rem, 2.8vw, 2.15rem);
    font-weight: 850;
    letter-spacing: -.04em;
}

.tt-page-panel__header p {
    max-width: 760px;
    margin: 0;
    color: var(--tt-muted);
    line-height: 1.48;
}

.tt-page-panel__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    flex: 0 0 auto;
}

.tt-compact-metrics .tt-stat-card--compact {
    min-height: 92px;
    padding: 15px 16px;
    border-radius: 20px;
    gap: 13px;
}

.tt-compact-metrics .tt-stat-card--compact .tt-stat-icon {
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: 15px;
    font-size: 1.08rem;
}

.tt-compact-metrics .tt-stat-card--compact strong {
    font-size: 1.55rem;
}

.tt-list-card,
.tt-filter-card,
.tt-form-card {
    overflow: hidden;
}

.tt-card-header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 18px;
    background: linear-gradient(180deg, #fff 0%, #fbfdff 100%) !important;
}

.tt-card-header-flex strong,
.tt-card-header-flex span:not(.badge) {
    display: block;
}

.tt-card-header-flex strong {
    color: #0e253d;
    font-size: 1rem;
    font-weight: 820;
}

.tt-card-header-flex span:not(.badge) {
    margin-top: 2px;
    color: var(--tt-muted);
    font-size: .84rem;
}

.tt-table-responsive-clean {
    border: 0;
    border-radius: 0;
}

.tt-data-table thead th {
    padding: 13px 16px;
    color: #475569;
    background: #f7fbff;
    font-size: .78rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .035em;
    white-space: nowrap;
}

.tt-data-table tbody td {
    padding: 14px 16px;
    vertical-align: middle;
}

.tt-data-table tbody tr:hover {
    background: rgba(69, 199, 195, .045);
}

.tt-person-cell {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 220px;
}

.tt-person-avatar {
    width: 38px;
    height: 38px;
    min-width: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    color: var(--tt-primary);
    background: linear-gradient(135deg, #eaf4ff, #edfffd);
    font-weight: 850;
}

.tt-person-cell strong,
.tt-person-cell small,
.tt-muted-stack span,
.tt-muted-stack small,
.tt-date-cell strong,
.tt-date-cell small {
    display: block;
}

.tt-person-cell strong,
.tt-date-cell strong {
    color: #0e253d;
    font-weight: 820;
}

.tt-person-cell small,
.tt-muted-stack small,
.tt-date-cell small {
    color: var(--tt-muted);
    font-size: .78rem;
}

.tt-code-pill {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border: 1px solid rgba(15, 61, 102, .1);
    border-radius: 999px;
    color: #475569;
    background: #f8fbff;
    font-size: .78rem;
    font-weight: 750;
    white-space: nowrap;
}

.tt-agenda-metric {
    height: 100%;
    min-height: 90px;
    padding: 16px;
    border: 1px solid var(--tt-border);
    border-radius: 20px;
    background: #fff;
    box-shadow: var(--tt-shadow-soft);
}

.tt-agenda-metric span,
.tt-agenda-metric strong,
.tt-agenda-metric small {
    display: block;
}

.tt-agenda-metric span {
    color: var(--tt-muted);
    font-size: .78rem;
    font-weight: 800;
}

.tt-agenda-metric strong {
    margin: 3px 0;
    color: #0e253d;
    font-size: 1.7rem;
    line-height: 1;
    letter-spacing: -.04em;
}

.tt-agenda-metric small {
    color: var(--tt-muted);
    font-size: .75rem;
}

.tt-help-note {
    padding: 11px 13px;
    border-radius: 14px;
    color: #475569;
    background: #f8fbff;
    font-size: .86rem;
    line-height: 1.35;
}

.tt-agenda-table td {
    min-width: 120px;
}

.tt-agenda-table td:first-child {
    min-width: 150px;
}

.tt-agenda-actions {
    min-width: 360px;
}

.tt-action-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.tt-inline-update-form {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    width: 100%;
}

.tt-inline-update-form .form-select {
    max-width: 165px;
    min-height: 34px;
}

.tt-reschedule-box {
    width: 100%;
    max-width: 320px;
    text-align: left;
}

.tt-reschedule-box summary {
    list-style: none;
    display: inline-flex;
    cursor: pointer;
}

.tt-reschedule-box summary::-webkit-details-marker {
    display: none;
}

.tt-reschedule-box form {
    box-shadow: 0 10px 22px rgba(15, 61, 102, .08);
}

@media (max-width: 991.98px) {
    .tt-page-panel__header {
        flex-direction: column;
        padding: 18px;
    }
    .tt-page-panel__actions {
        justify-content: flex-start;
        width: 100%;
    }
    .tt-agenda-actions {
        min-width: 300px;
    }
}

@media (max-width: 575.98px) {
    .tt-page-panel__actions .btn {
        width: 100%;
    }
    .tt-card-header-flex {
        align-items: flex-start;
        flex-direction: column;
    }
    .tt-inline-update-form {
        flex-direction: column;
        align-items: stretch;
    }
    .tt-inline-update-form .form-select {
        max-width: 100%;
    }
    .tt-action-stack {
        align-items: stretch;
    }
}

/* =========================================================
   Iteración UI 4 - Psicología: pacientes y expediente
   Mejora visual sin modificar lógica, rutas ni permisos.
   ========================================================= */
.tt-psychology-page,
.tt-clinical-page {
  max-width: 1480px;
  margin: 0 auto;
}

.tt-page-toolbar,
.tt-section-head,
.tt-patient-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.tt-page-title {
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #10213f;
}

.tt-page-subtitle,
.tt-meta-line {
  color: #64748b;
}

.tt-toolbar-actions,
.tt-patient-hero-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  flex-wrap: wrap;
}

.tt-overline {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #1f7ea0;
  margin-bottom: .25rem;
}

.tt-soft-panel,
.tt-content-card,
.tt-patient-hero {
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 24px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, .06);
}

.tt-soft-panel,
.tt-content-card {
  padding: 1.35rem;
}

.tt-patient-hero {
  padding: 1.35rem 1.5rem;
  align-items: center;
}

.tt-patient-hero-main {
  min-width: 0;
  flex: 1 1 520px;
}

.tt-patient-avatar-lg,
.tt-avatar-sm,
.tt-kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(73,198,194,.22), rgba(65,192,244,.18));
  color: #0f4f70;
}

.tt-patient-avatar-lg {
  width: 64px;
  height: 64px;
  border-radius: 22px;
  font-size: 1.35rem;
  font-weight: 800;
}

.tt-meta-line {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-wrap: wrap;
  font-size: .9rem;
}

.tt-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .9rem;
}

.tt-kpi-card.compact {
  min-height: 104px;
  padding: 1rem 1.05rem;
  display: flex;
  align-items: center;
  gap: .9rem;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(148, 163, 184, .2);
  border-radius: 22px;
  box-shadow: 0 14px 38px rgba(15, 23, 42, .055);
}

.tt-kpi-card.compact span {
  display: block;
  font-size: .82rem;
  color: #64748b;
  margin-bottom: .15rem;
}

.tt-kpi-card.compact strong {
  display: block;
  font-size: 1.85rem;
  line-height: 1;
  color: #10213f;
}

.tt-kpi-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  font-size: 1rem;
}

.tt-two-column-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 1.2rem;
  align-items: start;
}

.tt-side-card {
  position: sticky;
  top: 1rem;
}

.tt-chip-group {
  display: flex;
  gap: .45rem;
  flex-wrap: wrap;
}

.tt-chip-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: .35rem .75rem;
  border: 1px solid rgba(15, 76, 117, .16);
  border-radius: 999px;
  color: #28556b;
  text-decoration: none;
  background: rgba(255,255,255,.8);
  font-weight: 700;
  font-size: .86rem;
}

.tt-chip-link:hover,
.tt-chip-link.is-active {
  color: #fff;
  background: linear-gradient(135deg, #0f6d8f, #49c6c2);
  border-color: transparent;
}

.tt-table-wrap {
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 18px;
  overflow: hidden;
}

.tt-modern-table thead th {
  background: #f8fbfd;
  color: #496070;
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(148, 163, 184, .22);
}

.tt-modern-table td,
.tt-modern-table th {
  padding: .95rem 1rem;
  border-color: rgba(148, 163, 184, .14);
}

.tt-patient-cell {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 220px;
}

.tt-avatar-sm {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  font-weight: 800;
}

.tt-code-pill {
  display: inline-flex;
  padding: .28rem .55rem;
  border-radius: 999px;
  background: #f1f7fb;
  color: #28556b;
  font-weight: 700;
  font-size: .82rem;
}

.tt-empty-state {
  min-height: 92px;
  border: 1px dashed rgba(100, 116, 139, .3);
  border-radius: 18px;
  background: rgba(248, 251, 253, .72);
  color: #64748b;
  display: flex;
  justify-content: center;
  flex-direction: column;
  gap: .25rem;
  padding: 1rem;
  text-align: center;
}

/* Expediente clínico: reduce pesadez y mejora proporciones. */
.tt-clinical-page .psico-pro-stat {
  min-height: 96px;
  border-radius: 20px;
  padding: 1rem;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .055);
}

.tt-clinical-page .psico-pro-stat .label {
  font-size: .76rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #64748b;
}

.tt-clinical-page .psico-pro-stat .value {
  color: #10213f;
  font-weight: 800;
}

.tt-clinical-page .psico-pro-card,
.tt-clinical-page .card-soft,
.tt-clinical-page .card {
  border-radius: 22px;
  border-color: rgba(148, 163, 184, .2) !important;
  box-shadow: 0 14px 40px rgba(15, 23, 42, .055);
}

.tt-clinical-page .list-group-item {
  border-color: rgba(148, 163, 184, .18);
}

@media (max-width: 1199.98px) {
  .tt-kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tt-two-column-layout { grid-template-columns: 1fr; }
  .tt-side-card { position: static; }
}

@media (max-width: 767.98px) {
  .tt-kpi-row { grid-template-columns: 1fr; }
  .tt-page-toolbar,
  .tt-patient-hero { align-items: stretch; }
  .tt-toolbar-actions,
  .tt-patient-hero-actions { justify-content: flex-start; }
  .tt-soft-panel,
  .tt-content-card,
  .tt-patient-hero { padding: 1rem; border-radius: 18px; }
  .tt-modern-table td,
  .tt-modern-table th { padding: .75rem; }
}

/* =========================================================
   Iteración UI 4.1 - Corrección de ancho en pacientes de Psicología
   Evita que la tabla se corte en vistas de subespecialidad.
   ========================================================= */
.tt-psychology-page .tt-two-column-layout {
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.tt-psychology-page .tt-side-card {
  position: static;
  max-width: none;
}

.tt-psychology-page .tt-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tt-psychology-page .tt-modern-table {
  width: 100%;
  min-width: 860px;
}

.tt-psychology-page .tt-modern-table td,
.tt-psychology-page .tt-modern-table th {
  padding: .78rem .82rem;
  vertical-align: middle;
}

.tt-psychology-page .tt-modern-table thead th {
  white-space: nowrap;
  font-size: .74rem;
}

.tt-psychology-page .tt-patient-cell {
  min-width: 240px;
}

.tt-psychology-page .tt-modern-table .btn-sm {
  white-space: nowrap;
}

.tt-psychology-page .tt-content-card {
  overflow: hidden;
}

@media (min-width: 1500px) {
  .tt-psychology-page .tt-two-column-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
  }

  .tt-psychology-page .tt-side-card {
    position: sticky;
    top: 1rem;
  }
}

@media (max-width: 767.98px) {
  .tt-psychology-page .tt-modern-table {
    min-width: 760px;
  }
}

/* =========================================================
   Iteración UI 7 — IA Clínica, Reportes, Empresas, Suscripciones y Errores
   Solo presentación visual. No modifica lógica, rutas ni permisos.
   ========================================================= */
.tt-page-shell{
    max-width: 1320px;
    margin: 0 auto;
    padding: 4px 4px 28px;
}
.tt-page-header{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:18px;
    flex-wrap:wrap;
    margin-bottom:22px;
}
.tt-page-kicker{
    display:inline-flex;
    align-items:center;
    gap:8px;
    font-size:.76rem;
    font-weight:800;
    letter-spacing:.08em;
    text-transform:uppercase;
    color:#137a7f;
    background:#e8fbfb;
    border:1px solid #c7f1ee;
    border-radius:999px;
    padding:6px 10px;
    margin-bottom:10px;
}
.tt-page-title{
    font-size:1.55rem;
    font-weight:800;
    color:#13263c;
    margin:0 0 4px;
}
.tt-page-subtitle{
    color:#64748b;
    margin:0;
    max-width:760px;
}
.tt-actions{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
    align-items:center;
}
.tt-card{
    background:#fff;
    border:1px solid rgba(15,61,102,.08);
    border-radius:18px;
    box-shadow:0 12px 34px rgba(15,61,102,.075);
}
.tt-card-header{
    padding:18px 20px 0;
}
.tt-card-body{
    padding:20px;
}
.tt-stat-card{
    background:#fff;
    border:1px solid rgba(15,61,102,.08);
    border-radius:18px;
    box-shadow:0 10px 24px rgba(15,61,102,.06);
    padding:18px;
    height:100%;
}
.tt-stat-label{
    color:#64748b;
    font-size:.78rem;
    font-weight:700;
    text-transform:uppercase;
    letter-spacing:.04em;
    margin-bottom:6px;
}
.tt-stat-value{
    font-size:1.85rem;
    line-height:1;
    font-weight:850;
    color:#102a43;
}
.tt-stat-help{
    color:#718096;
    font-size:.86rem;
    margin-top:6px;
}
.tt-icon-badge{
    width:42px;
    height:42px;
    border-radius:14px;
    background:#e8fbfb;
    color:#0f7b7f;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    flex:0 0 auto;
}
.tt-filter-card{
    background:#fff;
    border:1px solid rgba(15,61,102,.08);
    border-radius:18px;
    box-shadow:0 10px 26px rgba(15,61,102,.06);
}
.tt-table-card .table{ margin-bottom:0; }
.tt-table-card thead th{
    color:#5b6b7d;
    font-size:.78rem;
    text-transform:uppercase;
    letter-spacing:.045em;
    border-bottom:1px solid #e8eef6;
    background:#f8fafc;
}
.tt-table-card tbody td{
    vertical-align:middle;
    border-color:#edf2f7;
}
.tt-soft-section{
    background:linear-gradient(135deg,#f8fcff 0%,#eefbfa 100%);
    border:1px solid #dbeef0;
    border-radius:20px;
    padding:20px;
}
.tt-plan-pill{
    display:inline-flex;
    align-items:center;
    gap:8px;
    padding:9px 12px;
    border-radius:999px;
    background:#0f7b7f;
    color:#fff;
    font-weight:700;
    box-shadow:0 10px 22px rgba(15,123,127,.18);
}
.tt-progress-thin{height:9px;border-radius:999px;background:#e9f0f7;overflow:hidden;}
.tt-progress-thin .progress-bar{border-radius:999px;}
.tt-check-list{list-style:none;padding:0;margin:0;display:grid;gap:10px;}
.tt-check-list li{display:flex;gap:10px;align-items:flex-start;color:#526276;font-size:.94rem;}
.tt-check-list i{margin-top:3px;color:#0f7b7f;}
.tt-error-shell{
    min-height:100vh;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:30px 14px;
    background:radial-gradient(circle at top left,#e8fbfb 0,#f5f7fb 36%,#f5f7fb 100%);
}
.tt-error-card{
    max-width:660px;
    width:100%;
    background:#fff;
    border:1px solid rgba(15,61,102,.08);
    border-radius:24px;
    box-shadow:0 24px 60px rgba(15,61,102,.14);
    padding:34px;
    text-align:left;
}
.tt-error-code{
    width:72px;
    height:72px;
    border-radius:22px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:1.4rem;
    font-weight:900;
    color:#fff;
    background:#0f7b7f;
    margin-bottom:18px;
}
.tt-error-code.danger{background:#c2410c;}
.tt-error-code.warning{background:#b45309;}
@media (max-width: 767.98px){
    .tt-page-shell{padding:0 0 22px;}
    .tt-page-title{font-size:1.3rem;}
    .tt-card-body{padding:16px;}
    .tt-error-card{padding:24px;}
    .tt-stat-value{font-size:1.55rem;}
}


/* Iteración UI 8.2 - Ajuste fino del sidebar del super usuario
   Objetivo: corregir desproporciones del menú sin alterar otras interfaces.
   - Reduce ligeramente la altura de cada opción.
   - Corrige el estilo del ítem activo.
   - Hace más compacta la tarjeta del usuario.
   - Agrega una separación visual sutil antes de las opciones administrativas.
   - No cambia rutas, permisos ni lógica. */
.tt-sidebar {
    padding: 16px 14px;
}
.tt-sidebar-brand {
    margin-bottom: 12px;
}
.tt-brand-mark {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 15px;
    font-size: .98rem;
}
.tt-brand-title { font-size: 1.02rem; }
.tt-brand-subtitle { font-size: .73rem; }
.tt-sidebar-nav { gap: 3px; }
.tt-nav-divider {
    height: 1px;
    margin: 8px 6px 6px;
    background: rgba(255,255,255,.12);
    border-radius: 999px;
}
.tt-nav-link {
    position: relative;
    min-height: 37px;
    padding: 7px 11px 7px 12px;
    border-radius: 14px;
    gap: 10px;
    font-size: .98rem;
}
.tt-nav-link:hover { transform: translateX(1px); }
.tt-nav-link.active {
    background: rgba(6, 20, 44, .36);
    box-shadow: none;
}
.tt-nav-link.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 7px;
    bottom: 7px;
    width: 4px;
    border-radius: 0 999px 999px 0;
    background: var(--tt-accent);
}
.tt-nav-icon {
    width: 20px;
    min-width: 20px;
    flex-basis: 20px;
    font-size: .98rem;
}
.tt-sidebar-user {
    margin-top: 10px;
    padding: 8px 10px;
    gap: 9px;
    border-radius: 15px;
}
.tt-user-avatar {
    width: 30px;
    height: 30px;
    min-width: 30px;
    font-size: .8rem;
}
.tt-user-name {
    font-size: .8rem;
    line-height: 1.05;
}
.tt-user-email {
    font-size: .66rem;
    margin-top: 1px;
    line-height: 1.05;
}
@media (max-height: 760px) {
    .tt-sidebar {
        padding-top: 14px;
        padding-bottom: 12px;
    }
    .tt-sidebar-brand { margin-bottom: 10px; }
    .tt-brand-mark {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }
    .tt-nav-link {
        min-height: 35px;
        padding-top: 6px;
        padding-bottom: 6px;
    }
    .tt-sidebar-user { padding: 7px 9px; }
}

/* Iteración UI 8.3 - Más separación entre marca y menú
   Ajuste solicitado: despegar el primer ítem del menú de la marca TodoTerapia.
   No cambia rutas, permisos, controladores ni base de datos. */
.tt-sidebar-brand {
    margin-bottom: 24px;
}

@media (max-height: 760px) {
    .tt-sidebar-brand {
        margin-bottom: 18px;
    }
}

/* Iteración UI 8.4 - Separación adicional entre marca y menú
   Ajuste fino solicitado: bajar un poco más el menú lateral. */
.tt-sidebar-brand {
    margin-bottom: 32px;
}

@media (max-height: 760px) {
    .tt-sidebar-brand {
        margin-bottom: 24px;
    }
}

/* Iteración UI 8.5 - Separación final entre marca y menú
   Ajuste fino: bajar otro poco el menú lateral. */
.tt-sidebar-brand {
    margin-bottom: 40px;
}

@media (max-height: 760px) {
    .tt-sidebar-brand {
        margin-bottom: 30px;
    }
}

/* Iteración UI 8.6 - Cerrar sesión visible en sidebar
   Agrega un botón pequeño de salida dentro de la tarjeta del usuario.
   No cambia rutas, permisos, controladores ni base de datos. */
.tt-sidebar-user {
    position: relative;
}

.tt-logout-form {
    margin: 0 0 0 auto;
    flex: 0 0 auto;
}

.tt-logout-button {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 10px;
    color: rgba(255,255,255,.88);
    background: rgba(255,255,255,.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .18s ease, transform .18s ease, color .18s ease;
}

.tt-logout-button:hover {
    background: rgba(255,255,255,.22);
    color: #fff;
    transform: translateY(-1px);
}

.tt-logout-button i {
    font-size: .82rem;
}

/* Indicadores globales de campos obligatorios en formularios. */
.tt-required-label {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
}

.tt-required-marker {
    color: #dc2626;
    font-weight: 900;
}

.tt-required-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 14px;
    padding: 7px 10px;
    border: 1px solid #fecaca;
    border-radius: 10px;
    background: #fff7f7;
    color: #7f1d1d;
    font-size: .86rem;
    font-weight: 700;
}

.form-control.tt-required-missing,
.form-select.tt-required-missing {
    border-color: #dc2626;
    box-shadow: 0 0 0 .18rem rgba(220,38,38,.12);
}

.tt-agenda-create-form .tt-agenda-time-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(9rem, 1fr));
    gap: .75rem;
    align-items: end;
    min-width: 19rem;
}

.tt-agenda-create-form .tt-agenda-time-field {
    display: grid;
    grid-template-columns: auto minmax(7rem, 1fr);
    gap: .45rem;
    align-items: center;
}

.tt-agenda-create-form .tt-agenda-time-field .form-label {
    margin-bottom: 0;
    white-space: nowrap;
}

.tt-agenda-create-form .tt-time-control {
    width: 100%;
    min-width: 7rem;
    font-variant-numeric: tabular-nums;
    padding-left: .75rem;
    padding-right: .75rem;
}

@media (min-width: 1200px) {
    .tt-agenda-create-form .tt-agenda-time-group {
        flex: 0 0 19rem;
        width: 19rem;
    }
}

@media (max-width: 575.98px) {
    .tt-agenda-create-form .tt-agenda-time-group {
        grid-template-columns: 1fr;
        min-width: 0;
    }

    .tt-agenda-create-form .tt-agenda-time-field {
        grid-template-columns: 4rem minmax(0, 1fr);
    }
}

/* =========================================================
   Producción - Menú móvil compacto por secciones
   Objetivo:
   - Mantener el sidebar completo en escritorio.
   - Mostrar en móvil una navegación resumida con secciones desplegables.
   - Mantener el botón Salir visible desde la parte superior del menú móvil.
   - No modifica rutas, permisos, controladores ni base de datos.
   ========================================================= */
.tt-sidebar-mobile-nav {
    display: none;
}

@media (max-width: 991.98px) {
    .tt-sidebar {
        height: 100dvh;
        max-height: 100dvh;
        padding: 14px 12px;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tt-sidebar-brand {
        margin-bottom: 14px;
    }

    .tt-sidebar-nav--desktop,
    .tt-sidebar > .tt-sidebar-user {
        display: none !important;
    }

    .tt-sidebar-mobile-nav {
        display: grid;
        gap: 8px;
        width: 100%;
        min-width: 0;
    }

    .tt-mobile-user-card {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        min-width: 0;
        padding: 10px;
        border: 1px solid rgba(255,255,255,.13);
        border-radius: 16px;
        background: rgba(255,255,255,.08);
    }

    .tt-mobile-user-card .tt-user-info {
        min-width: 0;
        flex: 1 1 auto;
    }

    .tt-mobile-user-card .tt-user-name,
    .tt-mobile-user-card .tt-user-email {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .tt-mobile-logout-form {
        margin: 0;
        flex: 0 0 auto;
    }

    .tt-mobile-logout-button {
        min-height: 34px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        padding: 7px 10px;
        border: 1px solid rgba(255,255,255,.14);
        border-radius: 12px;
        color: #fff;
        background: rgba(220, 53, 69, .92);
        font-size: .82rem;
        font-weight: 800;
        line-height: 1;
        cursor: pointer;
        transition: transform .18s ease, filter .18s ease, background .18s ease;
    }

    .tt-mobile-logout-button:hover,
    .tt-mobile-logout-button:focus {
        color: #fff;
        background: rgba(220, 53, 69, 1);
        filter: brightness(1.04);
        transform: translateY(-1px);
        outline: none;
    }

    .tt-mobile-nav-link,
    .tt-mobile-menu-group > summary {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        width: 100%;
        padding: 10px 12px;
        border: 1px solid rgba(255,255,255,.10);
        border-radius: 15px;
        color: rgba(255,255,255,.90);
        background: rgba(255,255,255,.075);
        font-weight: 800;
        line-height: 1.1;
        text-decoration: none;
        cursor: pointer;
        user-select: none;
    }

    .tt-mobile-nav-link:hover,
    .tt-mobile-menu-group > summary:hover,
    .tt-mobile-nav-link.active {
        color: #fff;
        background: rgba(255,255,255,.14);
    }

    .tt-mobile-nav-link.active {
        box-shadow: inset 4px 0 0 var(--tt-accent);
    }

    .tt-mobile-menu-group {
        margin: 0;
        border-radius: 16px;
    }

    .tt-mobile-menu-group > summary {
        list-style: none;
    }

    .tt-mobile-menu-group > summary::-webkit-details-marker {
        display: none;
    }

    .tt-mobile-menu-group > summary > span,
    .tt-mobile-nav-link > span {
        min-width: 0;
        display: inline-flex;
        align-items: center;
        gap: 10px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .tt-mobile-menu-group > summary .fa-chevron-down {
        font-size: .72rem;
        opacity: .78;
        transition: transform .18s ease;
    }

    .tt-mobile-menu-group[open] > summary .fa-chevron-down {
        transform: rotate(180deg);
    }

    .tt-mobile-menu-group__body {
        display: grid;
        gap: 5px;
        margin: 6px 0 2px;
        padding: 6px;
        border: 1px solid rgba(255,255,255,.09);
        border-radius: 14px;
        background: rgba(2, 12, 27, .14);
    }

    .tt-mobile-sub-link {
        display: flex;
        align-items: center;
        min-height: 38px;
        padding: 8px 10px 8px 14px;
        border-radius: 12px;
        color: rgba(255,255,255,.82);
        font-size: .92rem;
        font-weight: 700;
        line-height: 1.15;
        text-decoration: none;
    }

    .tt-mobile-sub-link:hover,
    .tt-mobile-sub-link.active {
        color: #fff;
        background: rgba(255,255,255,.12);
    }

    .tt-mobile-sub-link.active {
        box-shadow: inset 3px 0 0 var(--tt-accent);
    }

    .tt-sidebar-mobile-nav .tt-nav-icon {
        width: 20px;
        min-width: 20px;
        flex: 0 0 20px;
        text-align: center;
    }
}

@media (max-width: 380px) {
    .tt-mobile-logout-button span {
        display: none;
    }

    .tt-mobile-logout-button {
        width: 34px;
        padding-left: 0;
        padding-right: 0;
    }
}

/* =========================================================
   Producción 2 - Corrección final menú móvil acordeón
   Corrige: duplicación del menú, estilos nativos de <details>,
   carga visual del botón Salir y separación escritorio/móvil.
   ========================================================= */
.tt-sidebar-mobile-nav {
    display: none !important;
}

@media (min-width: 992px) {
    .tt-sidebar-nav--desktop {
        display: flex !important;
    }

    .tt-sidebar > .tt-sidebar-user {
        display: flex !important;
    }
}

@media (max-width: 991.98px) {
    .tt-sidebar {
        height: 100dvh;
        max-height: 100dvh;
        padding: 18px 12px 14px;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tt-sidebar-brand {
        margin-bottom: 16px !important;
    }

    .tt-sidebar-nav--desktop,
    .tt-sidebar > .tt-sidebar-user {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        min-height: 0 !important;
        max-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        overflow: hidden !important;
    }

    .tt-sidebar-mobile-nav {
        display: grid !important;
        gap: 8px;
        width: 100%;
        min-width: 0;
    }

    .tt-mobile-user-card {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        min-width: 0;
        padding: 10px;
        border: 1px solid rgba(255,255,255,.13);
        border-radius: 16px;
        background: rgba(255,255,255,.08);
    }

    .tt-mobile-user-card .tt-user-info {
        min-width: 0;
        flex: 1 1 auto;
    }

    .tt-mobile-user-card .tt-user-name,
    .tt-mobile-user-card .tt-user-email {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .tt-mobile-logout-form {
        margin: 0;
        flex: 0 0 auto;
    }

    .tt-mobile-logout-button {
        min-height: 34px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        padding: 7px 10px;
        border: 1px solid rgba(255,255,255,.14);
        border-radius: 12px;
        color: #fff;
        background: rgba(220, 53, 69, .92);
        font-family: inherit;
        font-size: .82rem;
        font-weight: 800;
        line-height: 1;
        cursor: pointer;
    }

    .tt-mobile-logout-button:hover,
    .tt-mobile-logout-button:focus {
        color: #fff;
        background: rgba(220, 53, 69, 1);
        outline: none;
    }

    .tt-mobile-main-link,
    .tt-mobile-nav-link,
    .tt-mobile-menu-group > summary {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        width: 100%;
        padding: 10px 12px;
        border: 1px solid rgba(255,255,255,.10);
        border-radius: 15px;
        color: rgba(255,255,255,.90);
        background: rgba(255,255,255,.075);
        font-weight: 800;
        line-height: 1.1;
        text-decoration: none;
        cursor: pointer;
        user-select: none;
    }

    .tt-mobile-main-link:hover,
    .tt-mobile-nav-link:hover,
    .tt-mobile-menu-group > summary:hover,
    .tt-mobile-main-link.active,
    .tt-mobile-nav-link.active {
        color: #fff;
        background: rgba(255,255,255,.14);
    }

    .tt-mobile-main-link.active,
    .tt-mobile-nav-link.active {
        box-shadow: inset 4px 0 0 var(--tt-accent);
    }

    .tt-mobile-menu-group {
        display: block;
        margin: 0;
        border-radius: 16px;
    }

    .tt-mobile-menu-group > summary {
        list-style: none !important;
    }

    .tt-mobile-menu-group > summary::marker,
    .tt-mobile-menu-group > summary::-webkit-details-marker {
        display: none !important;
        content: "" !important;
    }

    .tt-mobile-menu-group > summary > span,
    .tt-mobile-main-link > span,
    .tt-mobile-nav-link > span {
        min-width: 0;
        display: inline-flex;
        align-items: center;
        gap: 10px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .tt-mobile-chevron,
    .tt-mobile-menu-group > summary .fa-chevron-down {
        font-size: .78rem;
        opacity: .82;
        transition: transform .18s ease;
    }

    .tt-mobile-menu-group[open] > summary .tt-mobile-chevron,
    .tt-mobile-menu-group[open] > summary .fa-chevron-down {
        transform: rotate(180deg);
    }

    .tt-mobile-menu-group__body {
        display: grid;
        gap: 5px;
        margin: 6px 0 2px;
        padding: 6px;
        border: 1px solid rgba(255,255,255,.09);
        border-radius: 14px;
        background: rgba(2, 12, 27, .14);
    }

    .tt-mobile-sub-link {
        display: flex;
        align-items: center;
        min-height: 38px;
        padding: 8px 10px 8px 14px;
        border-radius: 12px;
        color: rgba(255,255,255,.82);
        font-size: .92rem;
        font-weight: 700;
        line-height: 1.15;
        text-decoration: none;
    }

    .tt-mobile-sub-link:hover,
    .tt-mobile-sub-link.active {
        color: #fff;
        background: rgba(255,255,255,.12);
    }

    .tt-mobile-sub-link.active {
        box-shadow: inset 3px 0 0 var(--tt-accent);
    }

    .tt-sidebar-mobile-nav .tt-nav-icon,
    .tt-sidebar-mobile-nav .fa-solid {
        flex: 0 0 auto;
    }
}

@media (max-width: 380px) {
    .tt-mobile-logout-button span {
        display: none;
    }

    .tt-mobile-logout-button {
        width: 34px;
        padding-left: 0;
        padding-right: 0;
    }
}

/* =========================================================
   Ajuste producción - Menú móvil: Salir al final
   Objetivo:
   - Mantener la tarjeta del usuario arriba solo como información.
   - Colocar el botón Salir al final del menú móvil.
   - Conservar escritorio sin cambios.
   ========================================================= */
@media (max-width: 991.98px) {
    .tt-mobile-user-card {
        align-items: center;
    }

    .tt-mobile-logout-form--bottom {
        width: 100%;
        margin: 10px 0 0 !important;
        padding-top: 10px;
        border-top: 1px solid rgba(255,255,255,.12);
    }

    .tt-mobile-logout-form--bottom .tt-mobile-logout-button {
        width: 100%;
        min-height: 46px;
        padding: 10px 14px;
        border-radius: 15px;
        font-size: .95rem;
    }
}

/* =========================================================
   Ajuste producción - Menú móvil: cuenta completa al final
   Objetivo:
   - La información del usuario (rol/nombre/correo) baja junto al botón Salir.
   - El bloque completo de cuenta queda al final del menú móvil.
   - El menú de escritorio permanece sin cambios.
   ========================================================= */
@media (max-width: 991.98px) {
    .tt-sidebar-mobile-nav {
        display: flex !important;
        flex-direction: column;
        gap: 8px;
        width: 100%;
        min-width: 0;
        flex: 1 1 auto;
        min-height: 0;
    }

    .tt-mobile-account-bottom {
        width: 100%;
        margin-top: auto;
        padding-top: 12px;
        border-top: 1px solid rgba(255,255,255,.12);
        display: grid;
        gap: 8px;
    }

    .tt-mobile-account-bottom .tt-mobile-user-card {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        min-width: 0;
        padding: 10px;
        border: 1px solid rgba(255,255,255,.13);
        border-radius: 16px;
        background: rgba(255,255,255,.08);
    }

    .tt-mobile-account-bottom .tt-mobile-logout-form--bottom {
        width: 100%;
        margin: 0 !important;
        padding-top: 0;
        border-top: 0;
    }

    .tt-mobile-account-bottom .tt-mobile-logout-button {
        width: 100%;
        min-height: 46px;
        padding: 10px 14px;
        border-radius: 15px;
        font-size: .95rem;
    }
}

/* =========================================================
   Ajuste móvil final - Cuenta y botón Salir en el mismo recuadro
   Objetivo: colocar nombre/correo y botón rojo Salir en una sola fila,
   manteniendo el bloque completo al final del menú móvil.
   ========================================================= */
@media (max-width: 991.98px) {
    .tt-mobile-account-bottom {
        gap: 0;
    }

    .tt-mobile-account-bottom .tt-mobile-user-card {
        display: flex;
        align-items: center;
        gap: 10px;
        min-height: 58px;
    }

    .tt-mobile-account-bottom .tt-mobile-user-card .tt-user-info {
        flex: 1 1 auto;
        min-width: 0;
    }

    .tt-mobile-account-bottom .tt-mobile-logout-form--bottom {
        flex: 0 0 auto;
        width: auto;
        margin: 0 0 0 auto !important;
        padding: 0;
        border: 0;
    }

    .tt-mobile-account-bottom .tt-mobile-logout-button {
        width: auto;
        min-width: 82px;
        min-height: 36px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        padding: 8px 11px;
        border: 0;
        border-radius: 12px;
        color: #ffffff;
        background: #dc2626;
        font-size: .82rem;
        font-weight: 850;
        box-shadow: 0 10px 22px rgba(220, 38, 38, .24);
    }

    .tt-mobile-account-bottom .tt-mobile-logout-button:hover,
    .tt-mobile-account-bottom .tt-mobile-logout-button:focus {
        color: #ffffff;
        background: #b91c1c;
        transform: translateY(-1px);
        outline: none;
    }

    .tt-mobile-account-bottom .tt-mobile-logout-button i {
        font-size: .86rem;
    }
}

@media (max-width: 380px) {
    .tt-mobile-account-bottom .tt-mobile-logout-button {
        min-width: 38px;
        width: 38px;
        height: 36px;
        padding: 0;
    }

    .tt-mobile-account-bottom .tt-mobile-logout-button span {
        display: none;
    }
}

/* =========================================================
   Ajuste móvil - Separación entre logo TodoTerapia y menú compacto
   Objetivo: bajar ligeramente el bloque Dashboard / Pacientes y agenda /
   Herramientas clínicas / Soporte para que no quede pegado al logo.
   No modifica escritorio, rutas, permisos ni lógica.
   ========================================================= */
@media (max-width: 991.98px) {
    .tt-sidebar-brand {
        margin-bottom: 48px !important;
    }

    .tt-sidebar-mobile-nav {
        padding-top: 4px;
    }
}

@media (max-width: 575.98px) {
    .tt-sidebar-brand {
        margin-bottom: 44px !important;
    }
}

/* =========================================================
   Ajuste móvil - Logo TodoTerapia más abajo desde la parte superior
   Solicitud: bajar el logo tres niveles más en el menú móvil.
   Solo afecta móvil. No modifica escritorio, rutas, permisos ni lógica.
   ========================================================= */
@media (max-width: 991.98px) {
    .tt-sidebar {
        padding-top: 48px !important;
    }
}

@media (max-width: 575.98px) {
    .tt-sidebar {
        padding-top: 52px !important;
    }
}


/* =========================================================
   Ajuste móvil - Logo TodoTerapia todavía más abajo
   Solicitud: bajar el logo tres niveles adicionales con relación
   a la parte superior del menú móvil.
   Solo afecta móvil. No modifica escritorio, rutas, permisos ni lógica.
   ========================================================= */
@media (max-width: 991.98px) {
    .tt-sidebar {
        padding-top: 84px !important;
    }
}

@media (max-width: 575.98px) {
    .tt-sidebar {
        padding-top: 88px !important;
    }
}

/* =========================================================
   Corrección dashboard - URL larga dentro de Empresa Activa
   Objetivo: evitar que la dirección de acceso actual se salga
   del contenedor derecho del hero del dashboard.
   No modifica rutas, permisos, lógica ni comportamiento PWA.
   ========================================================= */
.tt-page-hero,
.tt-page-hero__aside,
.tt-page-hero__aside *,
.tt-mini-card,
.tt-mini-card * {
    min-width: 0;
}

.tt-page-hero__aside {
    overflow: hidden;
}

.tt-mini-card {
    overflow: hidden;
}

.tt-mini-card span,
.tt-mini-card strong,
.tt-mini-card small {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
}

.tt-mini-card small {
    line-height: 1.45;
}

/* =========================================================
   Corrección final: URL larga en tarjeta Empresa activa
   Evita que direcciones largas se salgan o se corten mal.
   ========================================================= */

.tt-page-hero {
    overflow: hidden;
}

.tt-page-hero__aside {
    min-width: 0;
    max-width: 100%;
}

.tt-page-hero__aside .tt-mini-card {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.tt-page-hero__aside .tt-mini-card small {
    display: block;
    width: 100%;
    max-width: 100%;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    line-height: 1.45;
}


/* =========================================================
   TodoTerapia - Ajuste tipográfico profesional
   Objetivo:
   - Reducir sensación de bordes duros o texto demasiado pesado.
   - Mantener colores, estructura, espacios y diseño actual.
   - Mejorar lectura en dashboard, sidebar, tarjetas y botones.
   ========================================================= */

:root {
    --tt-font-sans: "Segoe UI", Inter, system-ui, -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
    --tt-weight-regular: 400;
    --tt-weight-medium: 500;
    --tt-weight-semibold: 600;
    --tt-weight-bold: 700;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body,
button,
input,
select,
textarea {
    font-family: var(--tt-font-sans) !important;
    font-synthesis: none;
}

/* FontAwesome también se renderiza como fuente; esto mejora sus bordes. */
.fa,
.fas,
.far,
.fab,
.fa-solid,
.fa-regular,
.fa-brands {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: auto;
}

/* Base general: evitar pesos exagerados en textos comunes. */
body {
    font-weight: var(--tt-weight-regular);
}

/* Sidebar: mantener fuerza visual, pero menos pesado. */
.tt-brand-title {
    font-weight: var(--tt-weight-bold) !important;
    letter-spacing: -0.02em;
}

.tt-brand-subtitle {
    font-weight: var(--tt-weight-regular) !important;
    letter-spacing: normal;
}

.tt-nav-link {
    font-weight: var(--tt-weight-semibold) !important;
    letter-spacing: -0.01em;
}

.tt-nav-link i {
    font-size: 0.98em;
}

/* Dashboard y hero principal. */
.tt-dash-intro h1 {
    font-weight: var(--tt-weight-bold) !important;
    letter-spacing: -0.035em;
}

.tt-dash-intro p {
    font-weight: var(--tt-weight-regular) !important;
    letter-spacing: normal;
}

.tt-dash-link,
.tt-dash-link span,
.tt-dash-link strong {
    font-weight: var(--tt-weight-semibold) !important;
}

/* Tarjetas de indicadores. */
.tt-stat-card strong,
.tt-stat-value {
    font-weight: var(--tt-weight-bold) !important;
    letter-spacing: -0.025em;
}

.tt-stat-card span,
.tt-stat-label,
.tt-stat-card small {
    font-weight: var(--tt-weight-regular) !important;
    letter-spacing: normal;
}

/* Secciones, módulos y cards. */
.tt-section-title,
.tt-card-title,
.tt-panel-title,
.tt-module-card h3,
.tt-dashboard-card-title,
.tt-subscription-title {
    font-weight: var(--tt-weight-bold) !important;
    letter-spacing: -0.025em;
}

.tt-section-subtitle,
.tt-card-subtitle,
.tt-module-card p,
.tt-small-muted,
.text-muted {
    font-weight: var(--tt-weight-regular) !important;
    letter-spacing: normal;
}

/* Botones: menos pesados, más limpios. */
.btn,
.tt-btn,
button {
    font-weight: var(--tt-weight-semibold) !important;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Encabezados generales. */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--tt-font-sans) !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.025em;
}

h1 {
    font-weight: var(--tt-weight-bold) !important;
}

h2,
h3 {
    font-weight: var(--tt-weight-bold) !important;
}

h4,
h5,
h6 {
    font-weight: var(--tt-weight-semibold) !important;
}

/* Cuenta de usuario y menú móvil. */
.tt-sidebar-user strong,
.tt-mobile-account-name {
    font-weight: var(--tt-weight-semibold) !important;
}

.tt-sidebar-user small,
.tt-mobile-account-email {
    font-weight: var(--tt-weight-regular) !important;
}

.tt-mobile-menu-link,
.tt-mobile-menu-summary {
    font-weight: var(--tt-weight-semibold) !important;
    letter-spacing: -0.01em;
}

/* Evita que algunos elementos transformados se vean más dentados. */
.tt-sidebar-brand,
.tt-brand-logo,
.tt-stat-icon,
.tt-nav-link,
.tt-dash-link,
.tt-mobile-menu-link,
.tt-mobile-menu-summary,
.btn {
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* Ajuste puntual: los textos extremadamente gruesos se suavizan por cascada. */
[style*="font-weight:800"],
[style*="font-weight: 800"],
[style*="font-weight:850"],
[style*="font-weight: 850"],
[style*="font-weight:900"],
[style*="font-weight: 900"] {
    font-weight: var(--tt-weight-bold) !important;
}


/* Usabilidad navegación 1: agrupación visual del menú lateral. */
.tt-nav-section-label {
    margin: 12px 10px 5px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.56);
}

.tt-sidebar-nav .tt-nav-section-label:first-child {
    margin-top: 4px;
}

.tt-nav-divider + .tt-nav-section-label {
    margin-top: 10px;
}

@media (max-width: 991.98px) {
    .tt-nav-section-label {
        display: none;
    }
}

/* Usabilidad Navegación 6: orientación visual del menú activo. */
.tt-sidebar-nav .tt-nav-link[aria-current="page"],
.tt-sidebar-mobile-nav a[aria-current="page"] {
    font-weight: 750 !important;
}

.tt-sidebar-nav .tt-nav-link.active .tt-nav-icon,
.tt-sidebar-nav .tt-nav-link[aria-current="page"] .tt-nav-icon {
    opacity: 1;
}

.tt-mobile-menu-group[open] > summary {
    background: rgba(255,255,255,.09);
    color: #fff;
}

.tt-mobile-menu-group[open] .tt-mobile-chevron {
    transform: rotate(180deg);
}

.tt-mobile-sub-link.active,
.tt-mobile-main-link.active {
    position: relative;
}

.tt-mobile-sub-link.active::before,
.tt-mobile-main-link.active::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 50%;
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: var(--tt-accent);
    transform: translateY(-50%);
}

.tt-topbar-subtitle {
    min-height: 1.15rem;
}

/* =========================================================
   Usabilidad - Navegación 7: menú móvil final
   Objetivo:
   - Mejorar lectura, tactilidad y cierre del menú móvil.
   - Mantener el contenido del menú desplazable sin mover la página de fondo.
   - Hacer más claro el enlace activo y dejar la cuenta/cierre de sesión accesible.
   ========================================================= */
@media (max-width: 991.98px) {
    body.tt-mobile-menu-open {
        overflow: hidden;
        touch-action: none;
    }

    .tt-sidebar {
        display: flex;
        flex-direction: column;
        width: min(90vw, 340px);
        max-width: min(90vw, 340px);
        padding: 12px;
        gap: 10px;
    }

    .tt-sidebar-brand {
        position: sticky;
        top: 0;
        z-index: 2;
        margin-bottom: 4px;
        padding-bottom: 10px;
        background: linear-gradient(180deg, rgba(15, 23, 42, .98), rgba(15, 23, 42, .86));
        backdrop-filter: blur(10px);
    }

    .tt-sidebar-mobile-nav {
        display: flex;
        flex-direction: column;
        gap: 8px;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        padding-right: 2px;
    }

    .tt-mobile-main-link,
    .tt-mobile-nav-link,
    .tt-mobile-menu-group > summary,
    .tt-mobile-sub-link {
        min-height: 46px;
        touch-action: manipulation;
    }

    .tt-mobile-main-link,
    .tt-mobile-nav-link,
    .tt-mobile-menu-group > summary {
        border-radius: 16px;
    }

    .tt-mobile-menu-group[open] > summary,
    .tt-mobile-main-link.active,
    .tt-mobile-nav-link.active {
        background: rgba(255,255,255,.15);
    }

    .tt-mobile-main-link.active,
    .tt-mobile-nav-link.active,
    .tt-mobile-sub-link.active {
        color: #fff;
        box-shadow: inset 4px 0 0 var(--tt-accent);
    }

    .tt-mobile-sub-link.active::before,
    .tt-mobile-main-link.active::before {
        display: none;
    }

    .tt-mobile-menu-group__body {
        margin-top: 6px;
        padding: 7px;
    }

    .tt-mobile-account-bottom {
        position: sticky;
        bottom: 0;
        z-index: 2;
        margin-top: auto;
        padding-top: 8px;
        background: linear-gradient(0deg, rgba(15, 23, 42, .98), rgba(15, 23, 42, .82));
        backdrop-filter: blur(10px);
    }

    .tt-mobile-user-card {
        box-shadow: 0 -8px 20px rgba(15, 23, 42, .14);
    }

    .tt-sidebar-backdrop {
        background: rgba(15, 23, 42, .58);
        backdrop-filter: blur(2px);
    }
}

@media (max-width: 420px) {
    .tt-sidebar {
        width: min(94vw, 340px);
        max-width: min(94vw, 340px);
    }

    .tt-mobile-main-link,
    .tt-mobile-nav-link,
    .tt-mobile-menu-group > summary {
        padding: 11px 12px;
    }

    .tt-mobile-sub-link {
        padding: 9px 10px 9px 14px;
    }
}

/* =========================================================
   Usabilidad módulos internos 4 - Agenda y sesiones
   Objetivo: orientar mejor el flujo de citas, expediente y registro de sesión.
   ========================================================= */
.tt-agenda-guide {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.6fr) minmax(150px, .6fr);
    gap: 14px;
    align-items: stretch;
    padding: 16px;
    border: 1px solid rgba(15, 61, 102, .1);
    border-radius: 22px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: var(--tt-shadow-soft);
}

.tt-agenda-guide__intro strong,
.tt-agenda-guide__today strong {
    display: block;
    color: #0e253d;
    font-weight: 850;
}

.tt-agenda-guide__intro p {
    margin: 5px 0 0;
    color: var(--tt-muted);
    font-size: .9rem;
    line-height: 1.45;
}

.tt-agenda-guide__steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.tt-agenda-guide__steps div {
    padding: 12px;
    border: 1px solid rgba(15, 61, 102, .08);
    border-radius: 16px;
    background: #fff;
}

.tt-agenda-guide__steps span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin-bottom: 7px;
    border-radius: 999px;
    background: #eef6ff;
    color: #0f3d66;
    font-weight: 850;
    font-size: .8rem;
}

.tt-agenda-guide__steps strong,
.tt-agenda-guide__steps small,
.tt-agenda-guide__today span,
.tt-agenda-guide__today a {
    display: block;
}

.tt-agenda-guide__steps strong {
    color: #0e253d;
    font-size: .9rem;
}

.tt-agenda-guide__steps small {
    color: var(--tt-muted);
    line-height: 1.35;
}

.tt-agenda-guide__today {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 14px;
    border: 1px solid rgba(15, 61, 102, .08);
    border-radius: 18px;
    background: #fff;
    text-align: center;
}

.tt-agenda-guide__today span {
    color: var(--tt-muted);
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.tt-agenda-guide__today strong {
    margin: 2px 0;
    font-size: 2rem;
    line-height: 1;
}

.tt-agenda-guide__today a {
    color: #0f3d66;
    font-size: .85rem;
    font-weight: 800;
    text-decoration: none;
}

.tt-empty-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

@media (max-width: 991.98px) {
    .tt-agenda-guide {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575.98px) {
    .tt-agenda-guide__steps {
        grid-template-columns: 1fr;
    }

    .tt-agenda-guide,
    .tt-agenda-guide__steps div,
    .tt-agenda-guide__today {
        border-radius: 16px;
    }
}

/* =========================================================
   Usabilidad módulos internos 8: consistencia responsive
   Cierre visual para módulos internos. No altera lógica.
   ========================================================= */
.tt-page-shell,
.tt-clinical-page,
.tt-psychology-page {
    width: 100%;
    max-width: 100%;
}

.tt-page-hero,
.tt-patient-hero,
.tt-psych-hero,
.tt-agenda-guide,
.tt-clinical-actions-panel,
.tt-page-panel,
.tt-content-card,
.tt-card,
.tt-form-card,
.tt-filter-card,
.tt-table-card,
.tt-list-card,
.tt-soft-panel,
.tt-side-card,
.tt-mini-card,
.tt-specialty-card,
.tt-kpi-card,
.tt-stat-card,
.tt-context-help {
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
}

.tt-page-hero,
.tt-patient-hero,
.tt-psych-hero,
.tt-agenda-guide {
    gap: 1rem;
}

.tt-page-title,
.tt-section-heading,
.tt-page-header h1,
.tt-page-hero h1,
.tt-patient-hero h1,
.tt-psych-hero h1 {
    line-height: 1.15;
}

.tt-page-subtitle,
.tt-meta-line,
.tt-stat-text,
.tt-card-body,
.tt-help-note,
.tt-empty-state,
.tt-patient-empty {
    color: var(--tt-muted);
}

.tt-hero-actions,
.tt-page-panel__actions,
.tt-toolbar-actions,
.tt-actions,
.tt-action-stack,
.tt-empty-actions,
.tt-patient-hero-actions,
.tt-agenda-actions,
.tt-clinical-action-grid,
.tt-quick-grid,
.tt-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    align-items: center;
}

.tt-hero-actions .btn,
.tt-page-panel__actions .btn,
.tt-toolbar-actions .btn,
.tt-actions .btn,
.tt-empty-actions .btn,
.tt-patient-hero-actions .btn,
.tt-agenda-actions .btn,
.tt-clinical-action-grid .btn,
.tt-quick-grid .btn,
.tt-card-action,
.tt-chip-link {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
}

.tt-compact-metrics,
.tt-kpi-row,
.tt-clinical-stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: .75rem;
}

/* Fix: métricas internas en grid sin heredar anchos Bootstrap que estrechan las tarjetas. */
.tt-compact-metrics > [class^="col-"],
.tt-compact-metrics > [class*=" col-"],
.tt-kpi-row > [class^="col-"],
.tt-kpi-row > [class*=" col-"],
.tt-clinical-stat-row > [class^="col-"],
.tt-clinical-stat-row > [class*=" col-"] {
    width: auto !important;
    max-width: none !important;
    flex: initial !important;
}

.tt-compact-metrics .tt-agenda-metric {
    min-width: 0;
    overflow-wrap: normal;
    word-break: normal;
}

.tt-compact-metrics .tt-agenda-metric span,
.tt-compact-metrics .tt-agenda-metric small {
    line-height: 1.25;
}

.tt-two-column-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 1rem;
    align-items: start;
}

.tt-table-wrap,
.tt-table-responsive-clean,
.table-responsive {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tt-data-table,
.tt-modern-table,
.tt-agenda-table {
    min-width: 720px;
}

.tt-data-table td,
.tt-data-table th,
.tt-modern-table td,
.tt-modern-table th,
.tt-agenda-table td,
.tt-agenda-table th {
    vertical-align: middle;
}

.tt-patient-search input,
.tt-filter-card input,
.tt-filter-card select,
.tt-form-card input,
.tt-form-card select,
.tt-form-card textarea,
.tt-agenda-create-form input,
.tt-agenda-create-form select,
.tt-agenda-create-form textarea {
    min-height: 42px;
}

.tt-empty-state,
.tt-patient-empty {
    border: 1px dashed rgba(15, 61, 102, .18);
    border-radius: 1.25rem;
    background: rgba(255, 255, 255, .72);
}

.tt-section-head,
.tt-page-panel__header,
.tt-card-header-flex {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
}

@media (max-width: 991.98px) {
    .tt-two-column-layout {
        grid-template-columns: 1fr;
    }

    .tt-page-hero,
    .tt-patient-hero,
    .tt-psych-hero,
    .tt-agenda-guide {
        grid-template-columns: 1fr !important;
    }

    .tt-page-hero__aside {
        width: 100%;
    }
}

@media (max-width: 767.98px) {
    .tt-page-shell,
    .tt-clinical-page,
    .tt-psychology-page {
        padding-inline: .25rem;
    }

    .tt-page-hero,
    .tt-patient-hero,
    .tt-psych-hero,
    .tt-agenda-guide,
    .tt-clinical-actions-panel,
    .tt-page-panel,
    .tt-content-card,
    .tt-card,
    .tt-form-card,
    .tt-filter-card,
    .tt-table-card,
    .tt-list-card,
    .tt-soft-panel,
    .tt-side-card,
    .tt-mini-card,
    .tt-specialty-card,
    .tt-kpi-card,
    .tt-stat-card {
        border-radius: 1rem !important;
    }

    .tt-page-hero,
    .tt-patient-hero,
    .tt-psych-hero,
    .tt-agenda-guide,
    .tt-page-panel,
    .tt-content-card,
    .tt-form-card,
    .tt-filter-card,
    .tt-table-card {
        padding: 1rem !important;
    }

    .tt-page-title,
    .tt-page-header h1,
    .tt-page-hero h1,
    .tt-patient-hero h1,
    .tt-psych-hero h1 {
        font-size: clamp(1.35rem, 7vw, 1.9rem) !important;
    }

    .tt-hero-actions,
    .tt-page-panel__actions,
    .tt-toolbar-actions,
    .tt-actions,
    .tt-action-stack,
    .tt-empty-actions,
    .tt-patient-hero-actions,
    .tt-agenda-actions,
    .tt-clinical-action-grid,
    .tt-quick-grid {
        width: 100%;
        align-items: stretch;
    }

    .tt-hero-actions .btn,
    .tt-page-panel__actions .btn,
    .tt-toolbar-actions .btn,
    .tt-actions .btn,
    .tt-action-stack .btn,
    .tt-empty-actions .btn,
    .tt-patient-hero-actions .btn,
    .tt-agenda-actions .btn,
    .tt-clinical-action-grid .btn,
    .tt-quick-grid .btn,
    .tt-card-action {
        width: 100%;
        white-space: normal;
        text-align: center;
    }

    .tt-compact-metrics,
    .tt-kpi-row,
    .tt-clinical-stat-row {
        grid-template-columns: 1fr 1fr;
    }

    .tt-section-head,
    .tt-page-panel__header,
    .tt-card-header-flex {
        display: block;
    }

    .tt-section-head > *,
    .tt-page-panel__header > *,
    .tt-card-header-flex > * {
        margin-bottom: .65rem;
    }

    .tt-data-table,
    .tt-modern-table,
    .tt-agenda-table {
        min-width: 640px;
    }
}

@media (max-width: 480px) {
    .tt-compact-metrics,
    .tt-kpi-row,
    .tt-clinical-stat-row {
        grid-template-columns: 1fr;
    }

    .tt-page-shell,
    .tt-clinical-page,
    .tt-psychology-page {
        padding-inline: 0;
    }
}

/* Fix agenda: usar el mismo patrón visual compacto del módulo Pacientes. */
.tt-agenda-summary-cards .tt-stat-card--compact {
    width: 100%;
    min-width: 0;
}

.tt-agenda-summary-cards .tt-stat-card--compact span,
.tt-agenda-summary-cards .tt-stat-card--compact small {
    overflow-wrap: normal;
    word-break: normal;
    white-space: normal;
}

/* Fix agenda: etiquetas de métricas más cortas y botón de filtro legible. */
.tt-agenda-summary-cards .tt-stat-card--compact {
    gap: .85rem;
    align-items: center;
}

.tt-agenda-summary-cards .tt-stat-card--compact span {
    line-height: 1.2;
    max-width: 100%;
}

.tt-agenda-summary-cards .tt-stat-card--compact strong {
    line-height: 1;
}

.tt-filter-card .btn {
    white-space: nowrap;
    min-width: 96px;
}


/* Fix pacientes: métricas más limpias, sin segunda línea descriptiva. */
.tt-patient-panel .tt-compact-metrics .tt-stat-card--compact {
    align-items: center;
}

.tt-patient-panel .tt-compact-metrics .tt-stat-card--compact span {
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
}

.tt-patient-panel .tt-compact-metrics .tt-stat-card--compact strong {
    line-height: 1;
}


/* Fix producción: agenda con métricas compactas y filtros en una línea. */
.tt-agenda-summary-cards {
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    align-items: stretch;
}

.tt-agenda-summary-cards .tt-stat-card--compact {
    min-height: 92px;
    padding: 14px 15px;
}

.tt-agenda-summary-cards .tt-stat-card--compact span {
    font-size: .9rem;
    font-weight: 800;
    line-height: 1.15;
    max-width: 100%;
}

.tt-agenda-summary-cards .tt-stat-card--compact strong {
    font-size: 1.6rem;
}

.tt-filter-card .tt-filter-submit {
    min-width: 112px;
    width: 100%;
}

/* Fix agenda adicional: iconos más pequeños para que las etiquetas quepan mejor. */
.tt-agenda-summary-cards .tt-stat-card--compact .tt-stat-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 12px;
    font-size: .92rem;
}

.tt-agenda-summary-cards .tt-stat-card--compact {
    gap: .65rem;
    padding: 12px 13px;
}

.tt-agenda-summary-cards .tt-stat-card--compact span {
    font-size: .84rem;
    line-height: 1.1;
}

.tt-agenda-summary-cards .tt-stat-card--compact strong {
    font-size: 1.5rem;
}

@media (min-width: 1200px) {
    .tt-agenda-summary-cards {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

@media (max-width: 991.98px) {
    .tt-agenda-summary-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .tt-agenda-summary-cards {
        grid-template-columns: 1fr;
    }
}


/* Optimización 2: estilos comunes movidos desde vistas/componentes al CSS central. */
body { background: #f5f7fb; }
.sidebar { min-height: 100vh; background: #0f3d66; }
.sidebar .nav-link { color: rgba(255,255,255,.88); }
.sidebar .nav-link.active,
.sidebar .nav-link:hover { background: rgba(255,255,255,.12); color: #fff; }
.brand-box { background: linear-gradient(135deg, #0f3d66 0%, #1d5d93 100%); color: #fff; }
.card-soft { border: 0; border-radius: 18px; box-shadow: 0 10px 25px rgba(15,61,102,.08); }
.module-card { transition: transform .15s ease, box-shadow .15s ease; }
.module-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(15,61,102,.14); }
.login-wrap { min-height: 100vh; }
.module-icon { font-size: 2rem; }

.tt-form-feedback {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(15, 23, 42, .10);
    background: #fff;
    box-shadow: 0 10px 26px rgba(15, 23, 42, .055);
}
.tt-form-feedback__icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 1rem;
}
.tt-form-feedback__title { font-weight: 800; margin-bottom: .2rem; color: #0f172a; }
.tt-form-feedback__message,
.tt-form-feedback__list { color: #334155; }
.tt-form-feedback__list { padding-left: 1.15rem; }
.tt-form-feedback__list li + li { margin-top: .25rem; }
.tt-form-feedback__help { color: #64748b; font-size: .875rem; }
.tt-form-feedback--success { border-color: rgba(34, 197, 94, .25); background: #f0fdf4; }
.tt-form-feedback--success .tt-form-feedback__icon { color: #166534; background: #dcfce7; }
.tt-form-feedback--error { border-color: rgba(239, 68, 68, .25); background: #fff7f7; }
.tt-form-feedback--error .tt-form-feedback__icon { color: #991b1b; background: #fee2e2; }
.tt-form-feedback--info { border-color: rgba(14, 165, 233, .25); background: #f0f9ff; }
.tt-form-feedback--info .tt-form-feedback__icon { color: #075985; background: #e0f2fe; }

.tt-context-help {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    margin-top: 1.25rem;
    padding: 1rem;
    border-radius: 1.25rem;
    border: 1px solid rgba(15, 23, 42, .08);
    background: linear-gradient(135deg, #ffffff, #f8fbff);
    box-shadow: 0 14px 34px rgba(15, 23, 42, .06);
}
.tt-context-help__icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 1rem;
    display: grid;
    place-items: center;
    background: #eaf6ff;
    color: #0f75bd;
    font-size: 1.15rem;
}
.tt-context-help__area {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-bottom: .25rem;
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #64748b;
}
.tt-context-help h2 {
    margin: 0 0 .2rem;
    font-size: 1.05rem;
    font-weight: 850;
    color: #0f172a;
}
.tt-context-help p { margin: 0; color: #475569; }
.tt-context-help__hint {
    margin-top: .45rem;
    color: #64748b;
    font-size: .86rem;
}
.tt-context-help__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .45rem;
}
@media (max-width: 767.98px) {
    .tt-context-help { grid-template-columns: 1fr; }
    .tt-context-help__icon { display: none; }
    .tt-context-help__actions { justify-content: stretch; }
    .tt-context-help__actions .btn { width: 100%; }
}
@media (max-width: 575.98px) {
    .tt-form-feedback { padding: .9rem; }
    .tt-form-feedback__icon { width: 2rem; height: 2rem; }
}

/* Optimización 4: listados y tablas más livianos para pantallas con muchos registros. */
.table-responsive,
.tt-table-responsive-clean {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    contain: layout paint;
}

.tt-data-table,
.materials-table,
.billing-table,
.finance-table,
.services-table {
    width: 100%;
}

.tt-data-table thead th,
.materials-table thead th,
.billing-table thead th,
.finance-table thead th,
.services-table thead th {
    white-space: nowrap;
}

.tt-data-table tbody td,
.materials-table tbody td,
.billing-table tbody td,
.finance-table tbody td,
.services-table tbody td {
    vertical-align: middle;
}

@media (max-width: 991.98px) {
    .tt-data-table,
    .materials-table,
    .billing-table,
    .finance-table,
    .services-table {
        min-width: 760px;
    }

    .table-responsive,
    .tt-table-responsive-clean {
        border-radius: 18px;
    }
}

@supports (content-visibility: auto) {
    .materials-card,
    .billing-card,
    .finance-card,
    .services-card,
    .invoice-form-card,
    .invoice-detail-card,
    .tt-context-help,
    .tt-module-entry-card,
    .tt-module-card {
        content-visibility: auto;
        contain-intrinsic-size: 1px 420px;
    }
}

.tt-list-help-text {
    color: #64748b;
    font-size: .875rem;
}

/* Producción - Menú lateral escritorio con usuario fijo abajo
   Mantiene visible la tarjeta de usuario y el botón Salir.
   Solo las opciones del menú tienen scroll cuando no caben.
   No cambia rutas, permisos, controladores ni base de datos. */
@media (min-width: 992px) {
    .tt-sidebar {
        height: 100vh;
        max-height: 100vh;
        overflow: hidden !important;
        display: flex;
        flex-direction: column;
    }

    .tt-sidebar-brand {
        flex: 0 0 auto;
    }

    .tt-sidebar-nav--desktop {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding-bottom: 12px;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        scrollbar-width: thin;
    }

    .tt-sidebar-nav--desktop::-webkit-scrollbar {
        width: 7px;
    }

    .tt-sidebar-nav--desktop::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,.24);
        border-radius: 999px;
    }

    .tt-sidebar-user {
        flex: 0 0 auto;
        margin-top: 10px;
        margin-bottom: 4px;
        position: relative;
        z-index: 2;
        box-shadow: 0 -10px 26px rgba(8, 29, 50, .18);
    }
}

/* Producción - Ajuste definitivo: usuario y botón Salir siempre visibles en escritorio
   El bloque inferior queda fuera del scroll del menú y se reserva espacio para evitar cortes. */
@media (min-width: 992px) {
    .tt-sidebar {
        height: 100vh !important;
        max-height: 100vh !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        padding-bottom: 14px !important;
    }

    .tt-sidebar-brand {
        flex: 0 0 auto !important;
    }

    .tt-sidebar-nav--desktop {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding-bottom: 18px !important;
        margin-bottom: 8px !important;
    }

    .tt-sidebar > .tt-sidebar-user {
        flex: 0 0 auto !important;
        position: relative !important;
        bottom: auto !important;
        display: flex !important;
        width: 100% !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        padding: 10px 10px !important;
        border-radius: 18px !important;
        background: rgba(6, 20, 44, .58) !important;
        border: 1px solid rgba(255,255,255,.16) !important;
        box-shadow: 0 -12px 30px rgba(6, 20, 44, .24) !important;
        z-index: 5 !important;
    }

    .tt-sidebar > .tt-sidebar-user .tt-user-avatar {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
    }

    .tt-sidebar > .tt-sidebar-user .tt-user-info {
        min-width: 0 !important;
        flex: 1 1 auto !important;
    }

    .tt-sidebar > .tt-sidebar-user .tt-user-name,
    .tt-sidebar > .tt-sidebar-user .tt-user-email {
        max-width: 145px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .tt-sidebar > .tt-sidebar-user .tt-logout-form {
        flex: 0 0 auto !important;
        margin-left: auto !important;
    }

    .tt-sidebar > .tt-sidebar-user .tt-logout-button {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 7px !important;
        min-width: 82px !important;
        height: 38px !important;
        padding: 0 13px !important;
        border-radius: 14px !important;
        font-weight: 800 !important;
        color: #fff !important;
        background: linear-gradient(135deg, #ef4444, #dc2626) !important;
        box-shadow: 0 10px 22px rgba(220, 38, 38, .26) !important;
    }

    .tt-sidebar > .tt-sidebar-user .tt-logout-button span {
        display: inline !important;
    }
}

/* Producción: salida visible en escritorio fuera del scroll del menú.
   El botón queda en la barra superior para no depender del alto del sidebar. */
.tt-topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.tt-topbar-logout-form {
    margin: 0;
}

.tt-topbar-logout-btn {
    border-radius: 999px;
    font-weight: 800;
    padding-left: 14px;
    padding-right: 14px;
    box-shadow: 0 8px 18px rgba(220, 38, 38, .16);
}

@media (max-width: 991.98px) {
    .tt-topbar-actions {
        display: none;
    }
}

@media (min-width: 992px) {
    .tt-sidebar > .tt-sidebar-user .tt-logout-form {
        display: none !important;
    }
}

/* Producción UX: cuenta y salida en barra superior de escritorio.
   Muestra solo el nombre del usuario, sin correo/dirección, para no cargar la franja. */
.tt-topbar-user-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 230px;
    padding: 6px 12px 6px 7px;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 999px;
    background: rgba(255,255,255,.82);
    color: #0f172a;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .06);
    white-space: nowrap;
}

.tt-topbar-user-avatar {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--tt-primary), var(--tt-accent));
    color: #fff;
    font-size: .78rem;
    font-weight: 850;
    flex: 0 0 auto;
}

.tt-topbar-user-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: .86rem;
    font-weight: 800;
}

@media (min-width: 992px) {
    .tt-topbar-actions {
        margin-left: auto;
        justify-content: flex-end;
        flex-wrap: nowrap;
    }

    .tt-sidebar > .tt-sidebar-user .tt-logout-form {
        display: none !important;
    }
}

@media (max-width: 1199.98px) {
    .tt-topbar-user-pill {
        max-width: 170px;
    }
}

@media (max-width: 991.98px) {
    .tt-topbar-user-pill {
        display: none;
    }
}

/* Producción UX - Sidebar escritorio sin bloque inferior y con scroll real.
   El usuario y Salir viven en la barra superior; el menú lateral queda solo para navegación. */
@media (min-width: 992px) {
    .tt-sidebar {
        height: 100vh !important;
        max-height: 100vh !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .tt-sidebar-brand {
        flex: 0 0 auto !important;
    }

    .tt-sidebar-nav--desktop {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        height: auto !important;
        max-height: calc(100vh - 104px) !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding-bottom: 34px !important;
        margin-bottom: 0 !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        scrollbar-width: thin;
    }

    .tt-sidebar-nav--desktop::-webkit-scrollbar {
        width: 7px !important;
    }

    .tt-sidebar-nav--desktop::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,.28) !important;
        border-radius: 999px !important;
    }

    .tt-sidebar > .tt-sidebar-user {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        min-height: 0 !important;
        max-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        overflow: hidden !important;
    }
}

/* =========================================================
   Producción UX - Scroll real del sidebar en escritorio
   Motivo: en pantallas de menor altura el contenedor interno podía quedar
   sin scroll visible. Se deja el sidebar completo como área desplazable.
   No toca rutas, permisos, controladores ni base de datos.
   ========================================================= */
@media (min-width: 992px) {
    .tt-sidebar {
        height: 100vh !important;
        max-height: 100vh !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: thin !important;
        scrollbar-color: rgba(255,255,255,.34) rgba(255,255,255,.08) !important;
    }

    .tt-sidebar::-webkit-scrollbar {
        width: 8px !important;
    }

    .tt-sidebar::-webkit-scrollbar-track {
        background: rgba(255,255,255,.08) !important;
        border-radius: 999px !important;
    }

    .tt-sidebar::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,.34) !important;
        border-radius: 999px !important;
    }

    .tt-sidebar-nav--desktop {
        flex: 0 0 auto !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        padding-bottom: 42px !important;
    }

    .tt-sidebar > .tt-sidebar-user {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        min-height: 0 !important;
        max-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        overflow: hidden !important;
    }
}

/* =========================================================
   Producción UX - Sidebar escritorio fijo con scroll real
   Solución definitiva: el sidebar deja de depender del scroll del documento.
   En escritorio queda fijo a la izquierda y su propio contenido desplaza.
   ========================================================= */
@media (min-width: 992px) {
    html,
    body {
        min-height: 100%;
    }

    .tt-app-shell {
        display: block !important;
        min-height: 100vh !important;
        width: 100% !important;
    }

    .tt-sidebar {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        width: var(--tt-sidebar-width) !important;
        min-width: var(--tt-sidebar-width) !important;
        height: 100vh !important;
        max-height: 100vh !important;
        padding: 18px 16px 28px !important;
        display: block !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        z-index: 1040 !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
        scrollbar-width: thin !important;
        scrollbar-gutter: stable !important;
        scrollbar-color: rgba(255,255,255,.38) rgba(255,255,255,.08) !important;
    }

    .tt-sidebar::-webkit-scrollbar {
        width: 8px !important;
    }

    .tt-sidebar::-webkit-scrollbar-track {
        background: rgba(255,255,255,.08) !important;
        border-radius: 999px !important;
    }

    .tt-sidebar::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,.38) !important;
        border-radius: 999px !important;
    }

    .tt-sidebar-brand {
        display: block !important;
        margin-bottom: 16px !important;
    }

    .tt-sidebar-nav--desktop {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        max-height: none !important;
        min-height: 0 !important;
        overflow: visible !important;
        padding-bottom: 48px !important;
        margin-bottom: 0 !important;
    }

    .tt-sidebar-mobile-nav,
    .tt-sidebar > .tt-sidebar-user {
        display: none !important;
    }

    .tt-main-area {
        margin-left: var(--tt-sidebar-width) !important;
        width: calc(100% - var(--tt-sidebar-width)) !important;
        min-height: 100vh !important;
        display: flex !important;
        flex-direction: column !important;
    }
}
