/* LEGASIST V39 · capa responsiva global sin alterar el diseño de escritorio */
:root{--lg-mobile-header:68px}
html{max-width:100%;overflow-x:hidden;-webkit-text-size-adjust:100%}
body{max-width:100%;min-width:320px;overflow-x:hidden}
img,video,canvas,svg,iframe{max-width:100%}
input,select,textarea,button{max-width:100%;font:inherit}
main,section,article,aside,header,footer,nav,form,fieldset,div{min-width:0}
pre,code,.meet-link,.file-name,.source-card a,.profile-detail b{overflow-wrap:anywhere;word-break:break-word}
.table-wrap,.table-responsive,.calendar-week,.sheet-scroll,.panel-body{max-width:100%}
.table-wrap,.table-responsive,.calendar-week{overflow-x:auto;-webkit-overflow-scrolling:touch}
.dash-table,.data-table,.credit-table{width:100%;border-collapse:collapse}
.modal,.modal-card,.dialog,.dialog-card{max-width:calc(100vw - 28px);max-height:calc(100dvh - 28px);overflow:auto}
.mobile-overlay{display:none}

/* El menú lateral funciona también en páginas que sólo usan .dash-layout */
@media (max-width:1180px){
  body.dashboard-body{overflow-x:hidden}
  .dash-layout,.dash-layout--fixed{display:block!important;min-height:100dvh!important;width:100%!important}
  .dash-sidebar{
    position:fixed!important;inset:0 auto 0 0!important;z-index:1100!important;
    width:min(292px,88vw)!important;height:100dvh!important;max-height:100dvh!important;
    transform:translate3d(-105%,0,0)!important;transition:transform .24s ease!important;
    box-shadow:0 28px 70px rgba(0,0,0,.34)!important;overflow-y:auto!important;
    visibility:hidden;pointer-events:none;
  }
  .dash-sidebar.open{transform:translate3d(0,0,0)!important;visibility:visible;pointer-events:auto}
  .mobile-overlay.show{display:block!important;position:fixed!important;inset:0!important;z-index:1090!important;background:rgba(3,12,27,.58)!important;backdrop-filter:blur(2px)}
  .dash-main{width:100%!important;max-width:100%!important;margin:0!important;padding:18px!important}
  .dash-topbar{height:auto!important;min-height:72px!important;display:flex!important;align-items:center!important;flex-wrap:wrap!important;padding:13px 16px!important;gap:12px!important}
  .menu-toggle,.legasist-menu-toggle{display:inline-grid!important;place-items:center!important;flex:0 0 44px!important;width:44px!important;height:44px!important;border:1px solid var(--dash-line)!important;border-radius:14px!important;background:var(--dash-soft)!important;color:var(--dash-primary)!important;font-size:1.3rem!important;cursor:pointer!important}
  .dash-topbar>.top-title{flex:1 1 260px!important;min-width:0!important}
  .dash-topbar>.top-actions{flex:0 1 auto!important;max-width:100%!important}
  body.legasist-menu-open{overflow:hidden!important;touch-action:none}

  .hero-panel,.dash-grid{grid-template-columns:1fr!important}
  .stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .quick-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .sheet-library-intro,.search-hero__inner,.search-shell,.calendar-shell,.agenda-shell,.support-control-hero,.favorites-hero{grid-template-columns:1fr!important}
  .filter-panel{position:static!important;top:auto!important}
  .lawyer-results,.favorite-cards,.sheet-case-grid,.independent-sheet-list{grid-template-columns:1fr!important}
  .profile-form-grid,.form-grid,.grid-two,.case-detail-grid,.case-summary-grid,.source-grid,.law-mini{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}

@media (max-width:900px){
  .dash-main{padding:15px!important}
  .panel-head,.calendar-head,.results-head,.sheet-library-heading,.sheet-section-heading,.quick-calculator-heading{align-items:flex-start!important;flex-wrap:wrap!important}
  .top-actions,.welcome-actions,.table-actions,.result-actions,.calendar-actions,.form-actions,.tool-actions{flex-wrap:wrap!important}
  .profile-form-grid,.form-grid,.grid-two,.case-detail-grid,.case-summary-grid,.source-grid,.law-mini{grid-template-columns:1fr!important}
  .agenda-workspace,.agenda-layout,.meet-layout,.chat-layout,.expediente-layout{grid-template-columns:1fr!important}
  .support-control-metrics,.hero-stats,.summary-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  .quick-calculator--top .quick-calculator-body{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .quick-calculator--top .calc-run-button,.quick-calculator--top .calc-result,.quick-calculator--top .calc-insert-button{width:100%!important}
  .sheet-case-card{grid-template-columns:44px minmax(0,1fr) auto!important}
  .spreadsheet-card{max-width:100%!important}
  .sheet-scroll{max-height:none!important;min-height:440px!important}
  .result-card{grid-template-columns:72px minmax(0,1fr)!important}
  .table-wrap,.panel-body{overflow-x:auto;-webkit-overflow-scrolling:touch}
  .dash-table,.data-table,.credit-table{min-width:720px}
  .week-grid{min-width:940px!important}
}

@media (max-width:700px){
  :root{--lg-mobile-header:62px}
  body{font-size:15px}
  .dash-main{padding:10px!important}
  .dash-topbar{position:sticky!important;top:0!important;z-index:100!important;margin-bottom:14px!important;border-radius:18px!important;padding:10px 12px!important;background:color-mix(in srgb,var(--dash-surface) 94%,transparent)!important}
  .dash-topbar>.top-title{order:2;flex:1 1 calc(100% - 58px)!important}
  .dash-topbar>.top-actions{order:3;width:100%!important;display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important}
  .dash-topbar>.top-actions:empty{display:none!important}
  .dash-topbar .top-title h1{font-size:1.28rem!important;line-height:1.15!important}
  .dash-topbar .top-title p{font-size:.8rem!important;line-height:1.35!important}
  .menu-toggle,.legasist-menu-toggle{order:1!important;width:42px!important;height:42px!important;flex-basis:42px!important}
  .dash-btn,.button,.btn,.calendar-btn,.tool-btn{min-height:42px!important;white-space:normal!important;text-align:center!important}
  .top-actions .dash-btn,.table-actions .dash-btn,.form-actions .dash-btn,.result-actions .button{width:100%!important}

  .hero-panel,.dash-grid,.stats-grid,.quick-grid,.support-control-metrics,.hero-stats,.summary-grid,.specialty-grid,.source-grid,.law-mini{grid-template-columns:1fr!important}
  .welcome-card,.image-card,.panel,.support-control-hero,.favorites-hero,.sheet-library-intro{border-radius:22px!important}
  .welcome-card,.support-control-hero,.favorites-hero{padding:22px!important;min-height:auto!important}
  .welcome-card h2,.support-control-hero h2,.favorites-hero h2{font-size:clamp(1.8rem,9vw,2.5rem)!important}
  .panel-head{padding:17px 16px 0!important}
  .panel-body{padding:15px 16px 17px!important}
  .stat-card,.quick-card,.favorite-card,.result-card,.sheet-case-card{padding:14px!important;border-radius:18px!important}
  .list-item{grid-template-columns:auto minmax(0,1fr)!important}
  .list-item>.pill,.list-item>.dash-btn,.list-item>.button{grid-column:1/-1!important;justify-self:stretch!important}
  .favorite-card,.result-card{grid-template-columns:1fr!important}
  .favorite-photo,.result-photo{width:76px!important;height:76px!important}
  .sheet-case-card{grid-template-columns:42px minmax(0,1fr)!important}
  .sheet-case-card .dash-btn{grid-column:1/-1!important;width:100%!important}
  .sheet-case-main h3,.sheet-case-main p,.sheet-case-main small{white-space:normal!important;overflow:visible!important;text-overflow:clip!important}
  .independent-sheet-list a{grid-template-columns:40px minmax(0,1fr)!important}
  .independent-sheet-list em{grid-column:2!important}
  .new-sheet-form>div{display:grid!important;grid-template-columns:1fr!important}
  .new-sheet-form .dash-btn{width:100%!important}

  .quick-calculator--top{padding:13px!important}
  .quick-calculator--top .quick-calculator-body{grid-template-columns:1fr!important}
  .quick-calculator-heading{display:grid!important;gap:6px!important}
  .quick-calculator input,.quick-calculator select,.sheet-cell{font-size:16px!important}
  .sheet-grid-toolbar{display:grid!important;grid-template-columns:1fr!important;gap:8px!important}
  .sheet-nav-controls{grid-template-columns:repeat(4,minmax(42px,1fr))!important;width:100%!important}
  .sheet-nav-controls button{width:100%!important;min-width:0!important}
  .sheet-nav-help{grid-column:1!important;grid-row:auto!important}
  .formula-panel{grid-template-columns:54px 34px minmax(0,1fr)!important}
  .formula-apply{grid-column:1/-1!important;width:100%!important;border-left:0!important;border-top:1px solid var(--dash-line)!important}
  .sheet-scroll{min-height:400px!important}
  .spreadsheet thead th,.spreadsheet td{min-width:104px!important}

  .calendar-form .form-row,.audio-format-row{grid-template-columns:1fr!important}
  .calendar-toolbar,.calendar-head,.selected-date{align-items:flex-start!important;flex-direction:column!important}
  .calendar-actions{width:100%!important;display:grid!important;grid-template-columns:1fr!important}
  .calendar-btn{width:100%!important}
  .personal-google-card{grid-template-columns:1fr!important}

  .login-shell,.login-role-abogado .login-shell,.lawyer-register-premium,.funnel-shell,.onboarding-shell{grid-template-columns:1fr!important}
  .login-card,.form-panel,.funnel-form,.onboarding-card{padding:20px!important;border-radius:22px!important}
  .login-image-panel,.lawyer-login-image-only{min-height:300px!important}
  .image-caption{left:14px!important;right:14px!important;bottom:14px!important;padding:15px!important}
  .nav,.law-nav,.topbar{padding-left:14px!important;padding-right:14px!important}
  .nav-links,.law-nav-links{flex-wrap:wrap!important;justify-content:flex-end!important}
  .directory-hero,.search-hero{padding-left:14px!important;padding-right:14px!important}

  .chat-composer,.message-composer,.ia-composer{grid-template-columns:1fr!important}
  .chat-composer button,.message-composer button,.ia-composer button{width:100%!important}
  .chat-bubble,.message-bubble{max-width:92%!important}

  .modal,.modal-card,.dialog,.dialog-card{width:calc(100vw - 20px)!important;max-width:calc(100vw - 20px)!important;margin:10px!important;border-radius:20px!important}
}

@media (max-width:460px){
  body{min-width:0}
  .dash-main{padding:8px!important}
  .dash-topbar>.top-actions{grid-template-columns:1fr!important}
  .dash-sidebar{width:min(270px,92vw)!important;padding:13px!important}
  .dash-profile p{display:none!important}
  .dash-menu a{padding:9px 10px!important}
  .panel-head,.panel-body{padding-left:13px!important;padding-right:13px!important}
  .welcome-card,.support-control-hero,.favorites-hero{padding:18px!important}
  .sheet-library-intro{padding:13px!important}
  .sheet-library-heading{display:grid!important}
  .sheet-grid-position{min-width:0!important}
  .formula-shortcuts button{flex:1 1 42%!important}
  .dashboard-theme-toggle,.theme-toggle{right:10px!important;bottom:10px!important;width:46px!important;height:46px!important;border-radius:15px!important}
}

/* Herramientas con sidebar alterno */
@media (max-width:1100px){
  .tool-layout{grid-template-columns:1fr!important}
  .tool-sidebar{position:fixed!important;inset:0 auto 0 0!important;width:min(285px,88vw)!important;height:100dvh!important;z-index:1100!important;transform:translateX(-105%)!important;visibility:hidden;pointer-events:none;overflow-y:auto!important}
  .tool-sidebar.open{transform:translateX(0)!important;visibility:visible;pointer-events:auto}
  .mobile-overlay-tool.show{display:block!important;position:fixed!important;inset:0!important;background:rgba(0,0,0,.58)!important;z-index:1090!important}
  .tool-main{width:100%!important;max-width:100%!important}
  .menu-toggle-tool{display:inline-flex!important}
}

/* Respeta usuarios con reducción de movimiento */
@media (prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}

/* Cabeceras y páginas públicas */
@media (max-width:980px){
  .hero-card,.hero__panel,.law-hero__grid,.success-layout,.onboard-layout,.payment-layout,.plans-layout,.contact-layout,.support-layout{grid-template-columns:1fr!important}
  .hero-media{min-height:280px!important}
  .law-preview,.side-preview{position:static!important}
  .pricing-grid,.plan-grid,.features-grid,.steps-grid,.benefits-grid,.footer-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}
@media (max-width:760px){
  .container,.law-container{width:min(100% - 24px,1180px)!important}
  .nav-inner,.topbar__inner,.law-topbar__inner{min-height:auto!important;padding:11px 0!important;flex-wrap:wrap!important}
  .nav-links,.nav-actions,.law-nav{width:100%!important;justify-content:flex-start!important;flex-wrap:nowrap!important;overflow-x:auto!important;overscroll-behavior-inline:contain;-webkit-overflow-scrolling:touch;padding-bottom:4px!important;scrollbar-width:none}
  .nav-links::-webkit-scrollbar,.nav-actions::-webkit-scrollbar,.law-nav::-webkit-scrollbar{display:none}
  .nav-links a,.nav-actions a,.law-nav a{flex:0 0 auto!important}
  .brand,.nav-logo,.law-brand{max-width:100%;white-space:normal!important}
  .hero-card,.hero__panel{padding:22px!important;border-radius:24px!important}
  .hero-media{min-height:230px!important;padding:10px!important;border-radius:22px!important}
  .hero-actions,.hero-btns,.cta-btns,.law-actions{display:grid!important;grid-template-columns:1fr!important;width:100%!important}
  .hero-actions>*,.hero-btns>*,.cta-btns>*,.law-actions>*{width:100%!important}
  .pricing-grid,.plan-grid,.features-grid,.steps-grid,.benefits-grid,.footer-grid,.stats-panel,.next-steps{grid-template-columns:1fr!important}
  .law-heading h1,h1{overflow-wrap:anywhere}
}

/* =============================================================
   LEGASIST V40 · MENÚ MÓVIL UNIFICADO Y CAPA RESPONSIVA FINAL
   Esta sección se carga al final para neutralizar reglas antiguas.
   ============================================================= */
:root{
  --legasist-sidebar-mobile-width:min(292px,88vw);
  --legasist-sidebar-z:10020;
  --legasist-overlay-z:10010;
  --legasist-topbar-z:5000;
}

/* Evita que una cuadrícula, tarjeta o contenido ancho expanda la página. */
html,body{width:100%;max-width:100%;overflow-x:hidden!important}
body.dashboard-body{min-width:0!important}
.dashboard-body .dash-layout,
.dashboard-body .dash-layout--fixed,
.dashboard-body .dash-main,
.dashboard-body .dash-topbar,
.dashboard-body .panel,
.dashboard-body .panel-body,
.dashboard-body .hero-panel,
.dashboard-body .dash-grid,
.dashboard-body .stats-grid,
.dashboard-body .quick-grid,
.dashboard-body .calendar-shell,
.dashboard-body .warehouse-grid,
.dashboard-body .agenda-shell,
.dashboard-body .agenda-workspace,
.dashboard-body .chat-layout,
.dashboard-body .expediente-layout,
.dashboard-body .sheet-library-intro,
.dashboard-body .spreadsheet-card{min-width:0!important;max-width:100%}

/* Los elementos decorativos nunca bloquean botones o enlaces. */
.welcome-card::before,.welcome-card::after,
.image-card::before,.image-card::after,
.support-control-hero::before,.support-control-hero::after,
.favorites-hero::before,.favorites-hero::after,
.scan-hero::before,.scan-hero::after,
.sheet-library-intro::before,.sheet-library-intro::after{pointer-events:none!important}

.legasist-sidebar-close{display:none}

@media (max-width:1180px){
  /* Neutraliza reglas antiguas que dejaban una columna fija o min-width. */
  body.dashboard-body .dash-layout,
  body.dashboard-body .dash-layout--fixed{
    display:block!important;
    grid-template-columns:minmax(0,1fr)!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    overflow:visible!important;
  }

  body.dashboard-body .dash-main{
    display:block!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    margin:0!important;
    padding:16px!important;
    overflow:visible!important;
  }

  /* Un único comportamiento para sidebar fijo, normal o generado manualmente. */
  body.dashboard-body .dash-sidebar,
  body.dashboard-body .dash-layout--fixed .dash-sidebar{
    display:flex!important;
    position:fixed!important;
    inset:0 auto 0 0!important;
    left:0!important;
    top:0!important;
    bottom:0!important;
    width:var(--legasist-sidebar-mobile-width)!important;
    min-width:0!important;
    max-width:92vw!important;
    height:100dvh!important;
    max-height:100dvh!important;
    margin:0!important;
    z-index:var(--legasist-sidebar-z)!important;
    transform:translate3d(calc(-100% - 24px),0,0)!important;
    opacity:0!important;
    visibility:hidden!important;
    pointer-events:none!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    overscroll-behavior:contain!important;
    -webkit-overflow-scrolling:touch!important;
    transition:transform .24s ease,opacity .2s ease,visibility .2s ease!important;
    box-shadow:0 30px 80px rgba(0,0,0,.34)!important;
    isolation:isolate!important;
  }

  body.dashboard-body .dash-sidebar.open,
  body.dashboard-body .dash-sidebar.is-open,
  body.dashboard-body.legasist-menu-open .dash-sidebar{
    transform:translate3d(0,0,0)!important;
    opacity:1!important;
    visibility:visible!important;
    pointer-events:auto!important;
  }

  body.dashboard-body .mobile-overlay,
  body.dashboard-body #overlay{
    display:block!important;
    position:fixed!important;
    inset:0!important;
    width:100vw!important;
    height:100dvh!important;
    margin:0!important;
    padding:0!important;
    z-index:var(--legasist-overlay-z)!important;
    background:rgba(2,10,24,.62)!important;
    backdrop-filter:blur(2px)!important;
    opacity:0!important;
    visibility:hidden!important;
    pointer-events:none!important;
    transition:opacity .2s ease,visibility .2s ease!important;
  }

  body.dashboard-body .mobile-overlay.show,
  body.dashboard-body #overlay.show,
  body.dashboard-body.legasist-menu-open .mobile-overlay,
  body.dashboard-body.legasist-menu-open #overlay{
    opacity:1!important;
    visibility:visible!important;
    pointer-events:auto!important;
  }

  body.dashboard-body.legasist-menu-open{
    overflow:hidden!important;
    touch-action:none!important;
  }

  /* El encabezado y el botón permanecen sobre todo el contenido normal. */
  body.dashboard-body .dash-topbar{
    position:sticky!important;
    top:max(8px,env(safe-area-inset-top))!important;
    z-index:var(--legasist-topbar-z)!important;
    isolation:isolate!important;
    width:100%!important;
    max-width:100%!important;
    min-height:72px!important;
    height:auto!important;
    margin:0 0 16px!important;
    padding:12px 15px!important;
    display:flex!important;
    align-items:center!important;
    flex-wrap:wrap!important;
    gap:10px 12px!important;
    overflow:visible!important;
  }

  body.dashboard-body .dash-topbar::before,
  body.dashboard-body .dash-topbar::after{pointer-events:none!important}

  body.dashboard-body .menu-toggle,
  body.dashboard-body .legasist-menu-toggle,
  body.dashboard-body #menuToggle,
  body.dashboard-body [data-legasist-menu-toggle]{
    appearance:none!important;
    display:inline-grid!important;
    place-items:center!important;
    position:relative!important;
    z-index:calc(var(--legasist-topbar-z) + 5)!important;
    flex:0 0 44px!important;
    width:44px!important;
    min-width:44px!important;
    max-width:44px!important;
    height:44px!important;
    min-height:44px!important;
    margin:0!important;
    padding:0!important;
    border:1px solid var(--dash-line,#cbd9ec)!important;
    border-radius:14px!important;
    background:var(--dash-soft,#eef5ff)!important;
    color:var(--dash-primary,#0f4ea8)!important;
    font-size:1.35rem!important;
    line-height:1!important;
    cursor:pointer!important;
    pointer-events:auto!important;
    touch-action:manipulation!important;
    user-select:none!important;
    -webkit-tap-highlight-color:transparent!important;
    box-shadow:none!important;
  }

  body.dashboard-body .menu-toggle:hover,
  body.dashboard-body .legasist-menu-toggle:hover,
  body.dashboard-body #menuToggle:hover,
  body.dashboard-body [data-legasist-menu-toggle]:hover{
    filter:brightness(.98)!important;
    transform:none!important;
  }

  body.dashboard-body .menu-toggle:focus-visible,
  body.dashboard-body .legasist-menu-toggle:focus-visible,
  body.dashboard-body #menuToggle:focus-visible,
  body.dashboard-body [data-legasist-menu-toggle]:focus-visible{
    outline:3px solid rgba(45,127,249,.35)!important;
    outline-offset:2px!important;
  }

  body.dashboard-body .legasist-sidebar-close{
    appearance:none!important;
    display:grid!important;
    place-items:center!important;
    position:absolute!important;
    top:max(10px,env(safe-area-inset-top))!important;
    right:10px!important;
    z-index:5!important;
    width:40px!important;
    height:40px!important;
    border:1px solid rgba(255,255,255,.24)!important;
    border-radius:13px!important;
    background:rgba(255,255,255,.12)!important;
    color:#fff!important;
    font-size:1.35rem!important;
    cursor:pointer!important;
    pointer-events:auto!important;
    touch-action:manipulation!important;
  }

  body.dashboard-body .dash-sidebar .dash-brand{padding-right:43px!important}
  body.dashboard-body .dash-sidebar .dash-brand--logo{padding-left:43px!important}

  body.dashboard-body .dash-topbar>.top-title{
    flex:1 1 260px!important;
    min-width:0!important;
  }
  body.dashboard-body .dash-topbar>.top-actions{
    flex:0 1 auto!important;
    max-width:100%!important;
  }

  /* Evita que layouts antiguos creen una página horizontal. */
  .calendar-shell,.warehouse-grid,.agenda-shell,.agenda-workspace,
  .chat-layout,.expediente-layout,.scan-grid,.search-shell,
  .profile-shell,.sheet-library-intro,.sheet-workspace,
  .support-layout,.contact-layout,.payment-layout,.plans-layout{
    min-width:0!important;
    max-width:100%!important;
  }

  .table-wrap,.table-responsive,.legasist-auto-table-wrap,
  .sheet-scroll,.calendar-week,.week-grid-wrap{
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    overflow-x:auto!important;
    overflow-y:visible;
    -webkit-overflow-scrolling:touch!important;
    overscroll-behavior-inline:contain!important;
  }
}

@media (min-width:1181px){
  body.dashboard-body .menu-toggle,
  body.dashboard-body .legasist-menu-toggle,
  body.dashboard-body #menuToggle,
  body.dashboard-body [data-legasist-menu-toggle],
  body.dashboard-body .legasist-sidebar-close{display:none!important}
  body.dashboard-body .mobile-overlay,
  body.dashboard-body #overlay{display:none!important}
}

@media (max-width:760px){
  :root{--legasist-sidebar-mobile-width:min(278px,92vw)}
  body.dashboard-body .dash-main{padding:9px!important}
  body.dashboard-body .dash-topbar{
    top:max(5px,env(safe-area-inset-top))!important;
    min-height:62px!important;
    padding:9px 10px!important;
    border-radius:18px!important;
  }
  body.dashboard-body .dash-topbar>.top-title{
    flex:1 1 calc(100% - 56px)!important;
    order:2!important;
  }
  body.dashboard-body .dash-topbar>.top-actions{
    order:3!important;
    width:100%!important;
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
  }
  body.dashboard-body .dash-topbar>.top-actions:empty{display:none!important}
  body.dashboard-body .menu-toggle,
  body.dashboard-body .legasist-menu-toggle,
  body.dashboard-body #menuToggle,
  body.dashboard-body [data-legasist-menu-toggle]{
    order:1!important;
    width:42px!important;
    min-width:42px!important;
    max-width:42px!important;
    height:42px!important;
    min-height:42px!important;
    flex-basis:42px!important;
  }
  .welcome-actions,.table-actions,.form-actions,.result-actions,.calendar-actions,
  .scan-toolbar,.tool-actions{max-width:100%!important}
  .welcome-actions>* ,.table-actions>* ,.form-actions>* ,.result-actions>* ,
  .calendar-actions>* ,.scan-toolbar>*{max-width:100%!important}

  /* Tarjetas, formularios y bloques siempre se ajustan. */
  .hero-panel,.dash-grid,.stats-grid,.quick-grid,.profile-form-grid,.form-grid,
  .grid-two,.case-detail-grid,.case-summary-grid,.source-grid,.law-mini,
  .agenda-workspace,.agenda-layout,.meet-layout,.chat-layout,.expediente-layout,
  .scan-grid,.favorite-cards,.sheet-case-grid,.independent-sheet-list{
    grid-template-columns:minmax(0,1fr)!important;
  }
  .panel,.welcome-card,.image-card,.support-control-hero,.favorites-hero,
  .scan-card,.sheet-library-intro,.spreadsheet-card{width:100%!important;max-width:100%!important}
  .welcome-card h1,.welcome-card h2,.support-control-hero h1,.support-control-hero h2,
  .favorites-hero h1,.favorites-hero h2,.scan-hero h1{overflow-wrap:anywhere!important}
}

@media (max-width:520px){
  body.dashboard-body .dash-topbar>.top-actions{grid-template-columns:minmax(0,1fr)!important}
  body.dashboard-body .dash-topbar>.top-title h1{font-size:1.16rem!important}
  body.dashboard-body .dash-topbar>.top-title p{font-size:.78rem!important}
  body.dashboard-body .dash-sidebar{padding:13px!important}
  body.dashboard-body .dash-sidebar .dash-brand--logo{padding-left:38px!important;padding-right:38px!important}
  body.dashboard-body .dash-sidebar .dash-profile{padding:13px!important}
  body.dashboard-body .dash-menu a{padding:10px!important;font-size:.88rem!important}
  body.dashboard-body .dash-btn,
  body.dashboard-body .button,
  body.dashboard-body .btn{white-space:normal!important;overflow-wrap:anywhere!important}
}


/* =============================================================
   LEGASIST V51 · RESPONSIVIDAD Y CAMPOS DE TEXTO
   ============================================================= */
/* Los datos escritos por el usuario conservan exactamente mayúsculas/minúsculas. */
input:not([type="button"]):not([type="submit"]):not([type="reset"]),textarea,[contenteditable="true"]{
  text-transform:none!important;
  font-variant-caps:normal!important;
}

/* Evita recortes por grids, tablas y paneles en cualquier ancho. */
.dash-table td,.dash-table th,.data-table td,.data-table th{overflow-wrap:anywhere}
.table-actions{display:flex!important;gap:8px!important;flex-wrap:wrap!important;align-items:center!important}
.panel,.panel-body,.workspace,.workspace-main,.workspace-side,.contact-card,.profile-shell,.profile-layout{min-width:0!important;max-width:100%!important}

/* La página pública mantiene toda la navegación visible, sin enlaces cortados. */
@media (max-width:760px){
  .topbar .topbar__inner{display:grid!important;grid-template-columns:1fr!important;gap:10px!important}
  .topbar .brand{justify-self:center!important}
  .topbar .nav-links{width:100%!important;display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important;overflow:visible!important;padding:0!important}
  .topbar .nav-links a{width:100%!important;min-width:0!important;white-space:normal!important;text-align:center!important;justify-content:center!important}
  .directory-hero__grid,.search-hero__inner,.search-shell{grid-template-columns:1fr!important}
  .search-panel,.filter-panel{width:100%!important;max-width:100%!important}
  .search-grid{grid-template-columns:1fr!important}
  .directory-chips{max-width:100%!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch}
  .voice-controls{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .voice-controls .voice-live{grid-column:1/-1!important;width:100%!important}
  .voice-action{width:100%!important;justify-content:center!important}
}
@media (max-width:430px){
  .topbar .nav-links{grid-template-columns:1fr!important}
  .voice-controls{grid-template-columns:1fr!important}
}

/* El expediente deja de usar columnas forzadas antes de que aparezca scroll horizontal. */
@media (max-width:1050px){
  .workspace{display:flex!important;flex-direction:column!important}
  .workspace-main,.workspace-side{width:100%!important;padding-left:0!important;padding-right:0!important}
  .workspace-side{margin-top:16px!important}
  .workspace-splitter{display:none!important}
}
